ChimeraTK-ControlSystemAdapter-OPCUAAdapter  01.07.01
open62541.c
Go to the documentation of this file.
1 /* THIS IS A SINGLE-FILE DISTRIBUTION CONCATENATED FROM THE OPEN62541 SOURCES
2  * visit http://open62541.org/ for information about this software
3  * Git-Revision: v0.2.2
4  */
5 
6 /*
7  * Copyright (C) 2014-2016 the contributors as stated in the AUTHORS file
8  *
9  * This file is part of open62541. open62541 is free software: you can
10  * redistribute it and/or modify it under the terms of the Mozilla Public
11  * License v2.0 as stated in the LICENSE file provided with open62541.
12  *
13  * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
14  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  * A PARTICULAR PURPOSE.
16  */
17 
18 #ifndef UA_DYNAMIC_LINKING_EXPORT
19 # define UA_DYNAMIC_LINKING_EXPORT
20 #endif
21 
22 #include "open62541.h"
23 
24 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/queue.h" ***********************************/
25 
26 /* $OpenBSD: queue.h,v 1.38 2013/07/03 15:05:21 fgsch Exp $ */
27 /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
28 
29 /*
30  * Copyright (c) 1991, 1993
31  * The Regents of the University of California. All rights reserved.
32  *
33  * Redistribution and use in source and binary forms, with or without
34  * modification, are permitted provided that the following conditions
35  * are met:
36  * 1. Redistributions of source code must retain the above copyright
37  * notice, this list of conditions and the following disclaimer.
38  * 2. Redistributions in binary form must reproduce the above copyright
39  * notice, this list of conditions and the following disclaimer in the
40  * documentation and/or other materials provided with the distribution.
41  * 3. Neither the name of the University nor the names of its contributors
42  * may be used to endorse or promote products derived from this software
43  * without specific prior written permission.
44  *
45  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55  * SUCH DAMAGE.
56  *
57  * @(#)queue.h 8.5 (Berkeley) 8/20/94
58  */
59 
60 #ifndef _SYS_QUEUE_H_
61 #define _SYS_QUEUE_H_
62 
63 /*
64  * This file defines five types of data structures: singly-linked lists,
65  * lists, simple queues, tail queues, and circular queues.
66  *
67  *
68  * A singly-linked list is headed by a single forward pointer. The elements
69  * are singly linked for minimum space and pointer manipulation overhead at
70  * the expense of O(n) removal for arbitrary elements. New elements can be
71  * added to the list after an existing element or at the head of the list.
72  * Elements being removed from the head of the list should use the explicit
73  * macro for this purpose for optimum efficiency. A singly-linked list may
74  * only be traversed in the forward direction. Singly-linked lists are ideal
75  * for applications with large datasets and few or no removals or for
76  * implementing a LIFO queue.
77  *
78  * A list is headed by a single forward pointer (or an array of forward
79  * pointers for a hash table header). The elements are doubly linked
80  * so that an arbitrary element can be removed without a need to
81  * traverse the list. New elements can be added to the list before
82  * or after an existing element or at the head of the list. A list
83  * may only be traversed in the forward direction.
84  *
85  * A simple queue is headed by a pair of pointers, one the head of the
86  * list and the other to the tail of the list. The elements are singly
87  * linked to save space, so elements can only be removed from the
88  * head of the list. New elements can be added to the list before or after
89  * an existing element, at the head of the list, or at the end of the
90  * list. A simple queue may only be traversed in the forward direction.
91  *
92  * A tail queue is headed by a pair of pointers, one to the head of the
93  * list and the other to the tail of the list. The elements are doubly
94  * linked so that an arbitrary element can be removed without a need to
95  * traverse the list. New elements can be added to the list before or
96  * after an existing element, at the head of the list, or at the end of
97  * the list. A tail queue may be traversed in either direction.
98  *
99  * A circle queue is headed by a pair of pointers, one to the head of the
100  * list and the other to the tail of the list. The elements are doubly
101  * linked so that an arbitrary element can be removed without a need to
102  * traverse the list. New elements can be added to the list before or after
103  * an existing element, at the head of the list, or at the end of the list.
104  * A circle queue may be traversed in either direction, but has a more
105  * complex end of list detection.
106  *
107  * For details on the use of these macros, see the queue(3) manual page.
108  */
109 
110 #if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC))
111 #define _Q_INVALIDATE(a) (a) = ((void *)-1)
112 #else
113 #define _Q_INVALIDATE(a)
114 #endif
115 
116 /*
117  * Singly-linked List definitions.
118  */
119 #define SLIST_HEAD(name, type) \
120 struct name { \
121  struct type *slh_first; /* first element */ \
122 }
123 
124 #define SLIST_HEAD_INITIALIZER(head) \
125  { NULL }
126 
127 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
128 # ifdef SLIST_ENTRY
129 # undef SLIST_ENTRY
130 # endif
131 
132 #define SLIST_ENTRY(type) \
133 struct { \
134  struct type *sle_next; /* next element */ \
135 }
136 
137 /*
138  * Singly-linked List access methods.
139  */
140 #define SLIST_FIRST(head) ((head)->slh_first)
141 #define SLIST_END(head) NULL
142 #define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
143 #define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
144 
145 #define SLIST_FOREACH(var, head, field) \
146  for((var) = SLIST_FIRST(head); \
147  (var) != SLIST_END(head); \
148  (var) = SLIST_NEXT(var, field))
149 
150 #define SLIST_FOREACH_SAFE(var, head, field, tvar) \
151  for ((var) = SLIST_FIRST(head); \
152  (var) && ((tvar) = SLIST_NEXT(var, field), 1); \
153  (var) = (tvar))
154 
155 /*
156  * Singly-linked List functions.
157  */
158 #define SLIST_INIT(head) { \
159  SLIST_FIRST(head) = SLIST_END(head); \
160 }
161 
162 #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
163  (elm)->field.sle_next = (slistelm)->field.sle_next; \
164  (slistelm)->field.sle_next = (elm); \
165 } while (0)
166 
167 #define SLIST_INSERT_HEAD(head, elm, field) do { \
168  (elm)->field.sle_next = (head)->slh_first; \
169  (head)->slh_first = (elm); \
170 } while (0)
171 
172 #define SLIST_REMOVE_AFTER(elm, field) do { \
173  (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
174 } while (0)
175 
176 #define SLIST_REMOVE_HEAD(head, field) do { \
177  (head)->slh_first = (head)->slh_first->field.sle_next; \
178 } while (0)
179 
180 #define SLIST_REMOVE(head, elm, type, field) do { \
181  if ((head)->slh_first == (elm)) { \
182  SLIST_REMOVE_HEAD((head), field); \
183  } else { \
184  struct type *curelm = (head)->slh_first; \
185  \
186  while (curelm->field.sle_next != (elm)) \
187  curelm = curelm->field.sle_next; \
188  curelm->field.sle_next = \
189  curelm->field.sle_next->field.sle_next; \
190  _Q_INVALIDATE((elm)->field.sle_next); \
191  } \
192 } while (0)
193 
194 /*
195  * List definitions.
196  */
197 #define LIST_HEAD(name, type) \
198 struct name { \
199  struct type *lh_first; /* first element */ \
200 }
201 
202 #define LIST_HEAD_INITIALIZER(head) \
203  { NULL }
204 
205 #define LIST_ENTRY(type) \
206 struct { \
207  struct type *le_next; /* next element */ \
208  struct type **le_prev; /* address of previous next element */ \
209 }
210 
211 /*
212  * List access methods
213  */
214 #define LIST_FIRST(head) ((head)->lh_first)
215 #define LIST_END(head) NULL
216 #define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
217 #define LIST_NEXT(elm, field) ((elm)->field.le_next)
218 
219 #define LIST_FOREACH(var, head, field) \
220  for((var) = LIST_FIRST(head); \
221  (var)!= LIST_END(head); \
222  (var) = LIST_NEXT(var, field))
223 
224 #define LIST_FOREACH_SAFE(var, head, field, tvar) \
225  for ((var) = LIST_FIRST(head); \
226  (var) && ((tvar) = LIST_NEXT(var, field), 1); \
227  (var) = (tvar))
228 
229 /*
230  * List functions.
231  */
232 #define LIST_INIT(head) do { \
233  LIST_FIRST(head) = LIST_END(head); \
234 } while (0)
235 
236 #define LIST_INSERT_AFTER(listelm, elm, field) do { \
237  if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
238  (listelm)->field.le_next->field.le_prev = \
239  &(elm)->field.le_next; \
240  (listelm)->field.le_next = (elm); \
241  (elm)->field.le_prev = &(listelm)->field.le_next; \
242 } while (0)
243 
244 #define LIST_INSERT_BEFORE(listelm, elm, field) do { \
245  (elm)->field.le_prev = (listelm)->field.le_prev; \
246  (elm)->field.le_next = (listelm); \
247  *(listelm)->field.le_prev = (elm); \
248  (listelm)->field.le_prev = &(elm)->field.le_next; \
249 } while (0)
250 
251 #define LIST_INSERT_HEAD(head, elm, field) do { \
252  if (((elm)->field.le_next = (head)->lh_first) != NULL) \
253  (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
254  (head)->lh_first = (elm); \
255  (elm)->field.le_prev = &(head)->lh_first; \
256 } while (0)
257 
258 #define LIST_REMOVE(elm, field) do { \
259  if ((elm)->field.le_next != NULL) \
260  (elm)->field.le_next->field.le_prev = \
261  (elm)->field.le_prev; \
262  *(elm)->field.le_prev = (elm)->field.le_next; \
263  _Q_INVALIDATE((elm)->field.le_prev); \
264  _Q_INVALIDATE((elm)->field.le_next); \
265 } while (0)
266 
267 #define LIST_REPLACE(elm, elm2, field) do { \
268  if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
269  (elm2)->field.le_next->field.le_prev = \
270  &(elm2)->field.le_next; \
271  (elm2)->field.le_prev = (elm)->field.le_prev; \
272  *(elm2)->field.le_prev = (elm2); \
273  _Q_INVALIDATE((elm)->field.le_prev); \
274  _Q_INVALIDATE((elm)->field.le_next); \
275 } while (0)
276 
277 /*
278  * Simple queue definitions.
279  */
280 #define SIMPLEQ_HEAD(name, type) \
281 struct name { \
282  struct type *sqh_first; /* first element */ \
283  struct type **sqh_last; /* addr of last next element */ \
284 }
285 
286 #define SIMPLEQ_HEAD_INITIALIZER(head) \
287  { NULL, &(head).sqh_first }
288 
289 #define SIMPLEQ_ENTRY(type) \
290 struct { \
291  struct type *sqe_next; /* next element */ \
292 }
293 
294 /*
295  * Simple queue access methods.
296  */
297 #define SIMPLEQ_FIRST(head) ((head)->sqh_first)
298 #define SIMPLEQ_END(head) NULL
299 #define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
300 #define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
301 
302 #define SIMPLEQ_FOREACH(var, head, field) \
303  for((var) = SIMPLEQ_FIRST(head); \
304  (var) != SIMPLEQ_END(head); \
305  (var) = SIMPLEQ_NEXT(var, field))
306 
307 #define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
308  for ((var) = SIMPLEQ_FIRST(head); \
309  (var) && ((tvar) = SIMPLEQ_NEXT(var, field), 1); \
310  (var) = (tvar))
311 
312 /*
313  * Simple queue functions.
314  */
315 #define SIMPLEQ_INIT(head) do { \
316  (head)->sqh_first = NULL; \
317  (head)->sqh_last = &(head)->sqh_first; \
318 } while (0)
319 
320 #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
321  if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
322  (head)->sqh_last = &(elm)->field.sqe_next; \
323  (head)->sqh_first = (elm); \
324 } while (0)
325 
326 #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
327  (elm)->field.sqe_next = NULL; \
328  *(head)->sqh_last = (elm); \
329  (head)->sqh_last = &(elm)->field.sqe_next; \
330 } while (0)
331 
332 #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
333  if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
334  (head)->sqh_last = &(elm)->field.sqe_next; \
335  (listelm)->field.sqe_next = (elm); \
336 } while (0)
337 
338 #define SIMPLEQ_REMOVE_HEAD(head, field) do { \
339  if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
340  (head)->sqh_last = &(head)->sqh_first; \
341 } while (0)
342 
343 #define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
344  if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
345  == NULL) \
346  (head)->sqh_last = &(elm)->field.sqe_next; \
347 } while (0)
348 
349 /*
350  * XOR Simple queue definitions.
351  */
352 #define XSIMPLEQ_HEAD(name, type) \
353 struct name { \
354  struct type *sqx_first; /* first element */ \
355  struct type **sqx_last; /* addr of last next element */ \
356  unsigned long sqx_cookie; \
357 }
358 
359 #define XSIMPLEQ_ENTRY(type) \
360 struct { \
361  struct type *sqx_next; /* next element */ \
362 }
363 
364 /*
365  * XOR Simple queue access methods.
366  */
367 #define XSIMPLEQ_XOR(head, ptr) ((__typeof(ptr))((head)->sqx_cookie ^ \
368  (unsigned long)(ptr)))
369 #define XSIMPLEQ_FIRST(head) XSIMPLEQ_XOR(head, ((head)->sqx_first))
370 #define XSIMPLEQ_END(head) NULL
371 #define XSIMPLEQ_EMPTY(head) (XSIMPLEQ_FIRST(head) == XSIMPLEQ_END(head))
372 #define XSIMPLEQ_NEXT(head, elm, field) XSIMPLEQ_XOR(head, ((elm)->field.sqx_next))
373 
374 
375 #define XSIMPLEQ_FOREACH(var, head, field) \
376  for ((var) = XSIMPLEQ_FIRST(head); \
377  (var) != XSIMPLEQ_END(head); \
378  (var) = XSIMPLEQ_NEXT(head, var, field))
379 
380 #define XSIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
381  for ((var) = XSIMPLEQ_FIRST(head); \
382  (var) && ((tvar) = XSIMPLEQ_NEXT(head, var, field), 1); \
383  (var) = (tvar))
384 
385 /*
386  * XOR Simple queue functions.
387  */
388 #define XSIMPLEQ_INIT(head) do { \
389  arc4random_buf(&(head)->sqx_cookie, sizeof((head)->sqx_cookie)); \
390  (head)->sqx_first = XSIMPLEQ_XOR(head, NULL); \
391  (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
392 } while (0)
393 
394 #define XSIMPLEQ_INSERT_HEAD(head, elm, field) do { \
395  if (((elm)->field.sqx_next = (head)->sqx_first) == \
396  XSIMPLEQ_XOR(head, NULL)) \
397  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
398  (head)->sqx_first = XSIMPLEQ_XOR(head, (elm)); \
399 } while (0)
400 
401 #define XSIMPLEQ_INSERT_TAIL(head, elm, field) do { \
402  (elm)->field.sqx_next = XSIMPLEQ_XOR(head, NULL); \
403  *(XSIMPLEQ_XOR(head, (head)->sqx_last)) = XSIMPLEQ_XOR(head, (elm)); \
404  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
405 } while (0)
406 
407 #define XSIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
408  if (((elm)->field.sqx_next = (listelm)->field.sqx_next) == \
409  XSIMPLEQ_XOR(head, NULL)) \
410  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
411  (listelm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)); \
412 } while (0)
413 
414 #define XSIMPLEQ_REMOVE_HEAD(head, field) do { \
415  if (((head)->sqx_first = XSIMPLEQ_XOR(head, \
416  (head)->sqx_first)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \
417  (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
418 } while (0)
419 
420 #define XSIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
421  if (((elm)->field.sqx_next = XSIMPLEQ_XOR(head, \
422  (elm)->field.sqx_next)->field.sqx_next) \
423  == XSIMPLEQ_XOR(head, NULL)) \
424  (head)->sqx_last = \
425  XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
426 } while (0)
427 
428 
429 /*
430  * Tail queue definitions.
431  */
432 #define TAILQ_HEAD(name, type) \
433 struct name { \
434  struct type *tqh_first; /* first element */ \
435  struct type **tqh_last; /* addr of last next element */ \
436 }
437 
438 #define TAILQ_HEAD_INITIALIZER(head) \
439  { NULL, &(head).tqh_first }
440 
441 #define TAILQ_ENTRY(type) \
442 struct { \
443  struct type *tqe_next; /* next element */ \
444  struct type **tqe_prev; /* address of previous next element */ \
445 }
446 
447 /*
448  * tail queue access methods
449  */
450 #define TAILQ_FIRST(head) ((head)->tqh_first)
451 #define TAILQ_END(head) NULL
452 #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
453 #define TAILQ_LAST(head, headname) \
454  (*(((struct headname *)((head)->tqh_last))->tqh_last))
455 /* XXX */
456 #define TAILQ_PREV(elm, headname, field) \
457  (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
458 #define TAILQ_EMPTY(head) \
459  (TAILQ_FIRST(head) == TAILQ_END(head))
460 
461 #define TAILQ_FOREACH(var, head, field) \
462  for((var) = TAILQ_FIRST(head); \
463  (var) != TAILQ_END(head); \
464  (var) = TAILQ_NEXT(var, field))
465 
466 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
467  for ((var) = TAILQ_FIRST(head); \
468  (var) != TAILQ_END(head) && \
469  ((tvar) = TAILQ_NEXT(var, field), 1); \
470  (var) = (tvar))
471 
472 
473 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
474  for((var) = TAILQ_LAST(head, headname); \
475  (var) != TAILQ_END(head); \
476  (var) = TAILQ_PREV(var, headname, field))
477 
478 #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
479  for ((var) = TAILQ_LAST(head, headname); \
480  (var) != TAILQ_END(head) && \
481  ((tvar) = TAILQ_PREV(var, headname, field), 1); \
482  (var) = (tvar))
483 
484 /*
485  * Tail queue functions.
486  */
487 #define TAILQ_INIT(head) do { \
488  (head)->tqh_first = NULL; \
489  (head)->tqh_last = &(head)->tqh_first; \
490 } while (0)
491 
492 #define TAILQ_INSERT_HEAD(head, elm, field) do { \
493  if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
494  (head)->tqh_first->field.tqe_prev = \
495  &(elm)->field.tqe_next; \
496  else \
497  (head)->tqh_last = &(elm)->field.tqe_next; \
498  (head)->tqh_first = (elm); \
499  (elm)->field.tqe_prev = &(head)->tqh_first; \
500 } while (0)
501 
502 #define TAILQ_INSERT_TAIL(head, elm, field) do { \
503  (elm)->field.tqe_next = NULL; \
504  (elm)->field.tqe_prev = (head)->tqh_last; \
505  *(head)->tqh_last = (elm); \
506  (head)->tqh_last = &(elm)->field.tqe_next; \
507 } while (0)
508 
509 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
510  if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
511  (elm)->field.tqe_next->field.tqe_prev = \
512  &(elm)->field.tqe_next; \
513  else \
514  (head)->tqh_last = &(elm)->field.tqe_next; \
515  (listelm)->field.tqe_next = (elm); \
516  (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
517 } while (0)
518 
519 #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
520  (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
521  (elm)->field.tqe_next = (listelm); \
522  *(listelm)->field.tqe_prev = (elm); \
523  (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
524 } while (0)
525 
526 #define TAILQ_REMOVE(head, elm, field) do { \
527  if (((elm)->field.tqe_next) != NULL) \
528  (elm)->field.tqe_next->field.tqe_prev = \
529  (elm)->field.tqe_prev; \
530  else \
531  (head)->tqh_last = (elm)->field.tqe_prev; \
532  *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
533  _Q_INVALIDATE((elm)->field.tqe_prev); \
534  _Q_INVALIDATE((elm)->field.tqe_next); \
535 } while (0)
536 
537 #define TAILQ_REPLACE(head, elm, elm2, field) do { \
538  if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
539  (elm2)->field.tqe_next->field.tqe_prev = \
540  &(elm2)->field.tqe_next; \
541  else \
542  (head)->tqh_last = &(elm2)->field.tqe_next; \
543  (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
544  *(elm2)->field.tqe_prev = (elm2); \
545  _Q_INVALIDATE((elm)->field.tqe_prev); \
546  _Q_INVALIDATE((elm)->field.tqe_next); \
547 } while (0)
548 
549 /*
550  * Circular queue definitions.
551  */
552 #define CIRCLEQ_HEAD(name, type) \
553 struct name { \
554  struct type *cqh_first; /* first element */ \
555  struct type *cqh_last; /* last element */ \
556 }
557 
558 #define CIRCLEQ_HEAD_INITIALIZER(head) \
559  { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
560 
561 #define CIRCLEQ_ENTRY(type) \
562 struct { \
563  struct type *cqe_next; /* next element */ \
564  struct type *cqe_prev; /* previous element */ \
565 }
566 
567 /*
568  * Circular queue access methods
569  */
570 #define CIRCLEQ_FIRST(head) ((head)->cqh_first)
571 #define CIRCLEQ_LAST(head) ((head)->cqh_last)
572 #define CIRCLEQ_END(head) ((void *)(head))
573 #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
574 #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
575 #define CIRCLEQ_EMPTY(head) \
576  (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
577 
578 #define CIRCLEQ_FOREACH(var, head, field) \
579  for((var) = CIRCLEQ_FIRST(head); \
580  (var) != CIRCLEQ_END(head); \
581  (var) = CIRCLEQ_NEXT(var, field))
582 
583 #define CIRCLEQ_FOREACH_SAFE(var, head, field, tvar) \
584  for ((var) = CIRCLEQ_FIRST(head); \
585  (var) != CIRCLEQ_END(head) && \
586  ((tvar) = CIRCLEQ_NEXT(var, field), 1); \
587  (var) = (tvar))
588 
589 #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
590  for((var) = CIRCLEQ_LAST(head); \
591  (var) != CIRCLEQ_END(head); \
592  (var) = CIRCLEQ_PREV(var, field))
593 
594 #define CIRCLEQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
595  for ((var) = CIRCLEQ_LAST(head, headname); \
596  (var) != CIRCLEQ_END(head) && \
597  ((tvar) = CIRCLEQ_PREV(var, headname, field), 1); \
598  (var) = (tvar))
599 
600 /*
601  * Circular queue functions.
602  */
603 #define CIRCLEQ_INIT(head) do { \
604  (head)->cqh_first = CIRCLEQ_END(head); \
605  (head)->cqh_last = CIRCLEQ_END(head); \
606 } while (0)
607 
608 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
609  (elm)->field.cqe_next = (listelm)->field.cqe_next; \
610  (elm)->field.cqe_prev = (listelm); \
611  if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
612  (head)->cqh_last = (elm); \
613  else \
614  (listelm)->field.cqe_next->field.cqe_prev = (elm); \
615  (listelm)->field.cqe_next = (elm); \
616 } while (0)
617 
618 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
619  (elm)->field.cqe_next = (listelm); \
620  (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
621  if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
622  (head)->cqh_first = (elm); \
623  else \
624  (listelm)->field.cqe_prev->field.cqe_next = (elm); \
625  (listelm)->field.cqe_prev = (elm); \
626 } while (0)
627 
628 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
629  (elm)->field.cqe_next = (head)->cqh_first; \
630  (elm)->field.cqe_prev = CIRCLEQ_END(head); \
631  if ((head)->cqh_last == CIRCLEQ_END(head)) \
632  (head)->cqh_last = (elm); \
633  else \
634  (head)->cqh_first->field.cqe_prev = (elm); \
635  (head)->cqh_first = (elm); \
636 } while (0)
637 
638 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
639  (elm)->field.cqe_next = CIRCLEQ_END(head); \
640  (elm)->field.cqe_prev = (head)->cqh_last; \
641  if ((head)->cqh_first == CIRCLEQ_END(head)) \
642  (head)->cqh_first = (elm); \
643  else \
644  (head)->cqh_last->field.cqe_next = (elm); \
645  (head)->cqh_last = (elm); \
646 } while (0)
647 
648 #define CIRCLEQ_REMOVE(head, elm, field) do { \
649  if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
650  (head)->cqh_last = (elm)->field.cqe_prev; \
651  else \
652  (elm)->field.cqe_next->field.cqe_prev = \
653  (elm)->field.cqe_prev; \
654  if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
655  (head)->cqh_first = (elm)->field.cqe_next; \
656  else \
657  (elm)->field.cqe_prev->field.cqe_next = \
658  (elm)->field.cqe_next; \
659  _Q_INVALIDATE((elm)->field.cqe_prev); \
660  _Q_INVALIDATE((elm)->field.cqe_next); \
661 } while (0)
662 
663 #define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
664  if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
665  CIRCLEQ_END(head)) \
666  (head)->cqh_last = (elm2); \
667  else \
668  (elm2)->field.cqe_next->field.cqe_prev = (elm2); \
669  if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
670  CIRCLEQ_END(head)) \
671  (head)->cqh_first = (elm2); \
672  else \
673  (elm2)->field.cqe_prev->field.cqe_next = (elm2); \
674  _Q_INVALIDATE((elm)->field.cqe_prev); \
675  _Q_INVALIDATE((elm)->field.cqe_next); \
676 } while (0)
677 
678 #endif /* !_SYS_QUEUE_H_ */
679 
680 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/pcg_basic.h" ***********************************/
681 
682 /*
683  * PCG Random Number Generation for C.
684  *
685  * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
686  *
687  * Licensed under the Apache License, Version 2.0 (the "License");
688  * you may not use this file except in compliance with the License.
689  * You may obtain a copy of the License at
690  *
691  * http://www.apache.org/licenses/LICENSE-2.0
692  *
693  * Unless required by applicable law or agreed to in writing, software
694  * distributed under the License is distributed on an "AS IS" BASIS,
695  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
696  * See the License for the specific language governing permissions and
697  * limitations under the License.
698  *
699  * For additional information about the PCG random number generation scheme,
700  * including its license and other licensing options, visit
701  *
702  * http://www.pcg-random.org
703  */
704 
705 
706 
707 #if __cplusplus
708 extern "C" {
709 #endif
710 
711 typedef struct pcg_state_setseq_64 {
712  uint64_t state; // RNG state. All values are possible.
713  uint64_t inc; // Controls which RNG sequence (stream) is selected. Must *always* be odd.
715 
716 #define PCG32_INITIALIZER { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL }
717 
718 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq);
719 uint32_t pcg32_random_r(pcg32_random_t* rng);
720 
721 #if __cplusplus
722 }
723 #endif
724 
725 
726 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/libc_time.h" ***********************************/
727 
728 
729 #include <limits.h>
730 #include <time.h>
731 int __secs_to_tm(long long t, struct tm *tm);
732 
733 
734 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_util.h" ***********************************/
735 
736 /* This Source Code Form is subject to the terms of the Mozilla Public
737 * License, v. 2.0. If a copy of the MPL was not distributed with this
738 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
739 
740 
741 
742 /* Assert */
743 #include <assert.h>
744 #define UA_assert(ignore) assert(ignore)
745 
746 /* BSD Queue Macros */
747 
748 /* container_of */
749 #define container_of(ptr, type, member) \
750  (type *)((uintptr_t)ptr - offsetof(type,member))
751 
752 /* Thread-Local Storage
753  * --------------------
754  * Thread-local variables are always enabled. Also when the library is built
755  * with ``UA_ENABLE_MULTITHREADING`` disabled. Otherwise, if multiple clients
756  * run in separate threads, race conditions may occur via global variables in
757  * the encoding layer. */
758 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
759 # define UA_THREAD_LOCAL _Thread_local /* C11 */
760 #elif defined(__GNUC__)
761 # define UA_THREAD_LOCAL __thread /* GNU extension */
762 #elif defined(_MSC_VER)
763 # define UA_THREAD_LOCAL __declspec(thread) /* MSVC extension */
764 #else
765 # warning The compiler does not support thread-local variables
766 # define UA_THREAD_LOCAL
767 #endif
768 
769 /* Integer Shortnames
770  * ------------------
771  * These are not exposed on the public API, since many user-applications make
772  * the same definitions in their headers. */
773 typedef UA_Byte u8;
774 typedef UA_SByte i8;
775 typedef UA_UInt16 u16;
776 typedef UA_Int16 i16;
777 typedef UA_UInt32 u32;
778 typedef UA_Int32 i32;
779 typedef UA_UInt64 u64;
780 typedef UA_Int64 i64;
782 
783 /* Atomic Operations
784  * -----------------
785  * Atomic operations that synchronize across processor cores (for
786  * multithreading). Only the inline-functions defined next are used. Replace
787  * with architecture-specific operations if necessary. */
788 #ifndef UA_ENABLE_MULTITHREADING
789 # define UA_atomic_sync()
790 #else
791 # ifdef _MSC_VER /* Visual Studio */
792 # define UA_atomic_sync() _ReadWriteBarrier()
793 # else /* GCC/Clang */
794 # define UA_atomic_sync() __sync_synchronize()
795 # endif
796 #endif
797 
798 static UA_INLINE void *
799 UA_atomic_xchg(void * volatile * addr, void *newptr) {
800 #ifndef UA_ENABLE_MULTITHREADING
801  void *old = *addr;
802  *addr = newptr;
803  return old;
804 #else
805 # ifdef _MSC_VER /* Visual Studio */
806  return _InterlockedExchangePointer(addr, newptr);
807 # else /* GCC/Clang */
808  return __sync_lock_test_and_set(addr, newptr);
809 # endif
810 #endif
811 }
812 
813 static UA_INLINE void *
814 UA_atomic_cmpxchg(void * volatile * addr, void *expected, void *newptr) {
815 #ifndef UA_ENABLE_MULTITHREADING
816  void *old = *addr;
817  if(old == expected) {
818  *addr = newptr;
819  }
820  return old;
821 #else
822 # ifdef _MSC_VER /* Visual Studio */
823  return _InterlockedCompareExchangePointer(addr, expected, newptr);
824 # else /* GCC/Clang */
825  return __sync_val_compare_and_swap(addr, expected, newptr);
826 # endif
827 #endif
828 }
829 
830 static UA_INLINE uint32_t
831 UA_atomic_add(volatile uint32_t *addr, uint32_t increase) {
832 #ifndef UA_ENABLE_MULTITHREADING
833  *addr += increase;
834  return *addr;
835 #else
836 # ifdef _MSC_VER /* Visual Studio */
837  return _InterlockedExchangeAdd(addr, increase) + increase;
838 # else /* GCC/Clang */
839  return __sync_add_and_fetch(addr, increase);
840 # endif
841 #endif
842 }
843 
844 
845 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types_encoding_binary.h" ***********************************/
846 
847 /* This Source Code Form is subject to the terms of the Mozilla Public
848 * License, v. 2.0. If a copy of the MPL was not distributed with this
849 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
850 
851 
852 
853 typedef UA_StatusCode (*UA_exchangeEncodeBuffer)(void *handle, UA_ByteString *buf, size_t offset);
854 
856 UA_encodeBinary(const void *src, const UA_DataType *type,
857  UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle,
858  UA_ByteString *dst, size_t *offset) UA_FUNC_ATTR_WARN_UNUSED_RESULT;
859 
861 UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst,
863 
864 size_t UA_calcSizeBinary(void *p, const UA_DataType *type);
865 
866 
867 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_types_generated_encoding_binary.h" ***********************************/
868 
869 /* Generated from Opc.Ua.Types.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
870  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:07 */
871 
872 
873 /* Boolean */
875 UA_Boolean_encodeBinary(const UA_Boolean *src, UA_ByteString *dst, size_t *offset) {
876  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BOOLEAN], NULL, NULL, dst, offset);
877 }
879 UA_Boolean_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Boolean *dst) {
880  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BOOLEAN]);
881 }
882 
883 /* SByte */
885 UA_SByte_encodeBinary(const UA_SByte *src, UA_ByteString *dst, size_t *offset) {
886  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SBYTE], NULL, NULL, dst, offset);
887 }
889 UA_SByte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SByte *dst) {
890  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SBYTE]);
891 }
892 
893 /* Byte */
895 UA_Byte_encodeBinary(const UA_Byte *src, UA_ByteString *dst, size_t *offset) {
896  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTE], NULL, NULL, dst, offset);
897 }
899 UA_Byte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Byte *dst) {
900  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTE]);
901 }
902 
903 /* Int16 */
905 UA_Int16_encodeBinary(const UA_Int16 *src, UA_ByteString *dst, size_t *offset) {
906  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT16], NULL, NULL, dst, offset);
907 }
909 UA_Int16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int16 *dst) {
910  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT16]);
911 }
912 
913 /* UInt16 */
915 UA_UInt16_encodeBinary(const UA_UInt16 *src, UA_ByteString *dst, size_t *offset) {
916  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT16], NULL, NULL, dst, offset);
917 }
919 UA_UInt16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt16 *dst) {
920  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT16]);
921 }
922 
923 /* Int32 */
925 UA_Int32_encodeBinary(const UA_Int32 *src, UA_ByteString *dst, size_t *offset) {
926  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT32], NULL, NULL, dst, offset);
927 }
929 UA_Int32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int32 *dst) {
930  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT32]);
931 }
932 
933 /* UInt32 */
935 UA_UInt32_encodeBinary(const UA_UInt32 *src, UA_ByteString *dst, size_t *offset) {
936  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT32], NULL, NULL, dst, offset);
937 }
939 UA_UInt32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt32 *dst) {
940  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT32]);
941 }
942 
943 /* Int64 */
945 UA_Int64_encodeBinary(const UA_Int64 *src, UA_ByteString *dst, size_t *offset) {
946  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT64], NULL, NULL, dst, offset);
947 }
949 UA_Int64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int64 *dst) {
950  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT64]);
951 }
952 
953 /* UInt64 */
955 UA_UInt64_encodeBinary(const UA_UInt64 *src, UA_ByteString *dst, size_t *offset) {
956  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT64], NULL, NULL, dst, offset);
957 }
959 UA_UInt64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt64 *dst) {
960  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT64]);
961 }
962 
963 /* Float */
965 UA_Float_encodeBinary(const UA_Float *src, UA_ByteString *dst, size_t *offset) {
966  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FLOAT], NULL, NULL, dst, offset);
967 }
969 UA_Float_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Float *dst) {
970  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FLOAT]);
971 }
972 
973 /* Double */
975 UA_Double_encodeBinary(const UA_Double *src, UA_ByteString *dst, size_t *offset) {
976  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DOUBLE], NULL, NULL, dst, offset);
977 }
979 UA_Double_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Double *dst) {
980  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DOUBLE]);
981 }
982 
983 /* String */
985 UA_String_encodeBinary(const UA_String *src, UA_ByteString *dst, size_t *offset) {
986  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STRING], NULL, NULL, dst, offset);
987 }
989 UA_String_decodeBinary(const UA_ByteString *src, size_t *offset, UA_String *dst) {
990  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STRING]);
991 }
992 
993 /* DateTime */
995 UA_DateTime_encodeBinary(const UA_DateTime *src, UA_ByteString *dst, size_t *offset) {
996  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATETIME], NULL, NULL, dst, offset);
997 }
999 UA_DateTime_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DateTime *dst) {
1000  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATETIME]);
1001 }
1002 
1003 /* Guid */
1004 static UA_INLINE UA_StatusCode
1005 UA_Guid_encodeBinary(const UA_Guid *src, UA_ByteString *dst, size_t *offset) {
1006  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GUID], NULL, NULL, dst, offset);
1007 }
1008 static UA_INLINE UA_StatusCode
1009 UA_Guid_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Guid *dst) {
1010  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GUID]);
1011 }
1012 
1013 /* ByteString */
1014 static UA_INLINE UA_StatusCode
1015 UA_ByteString_encodeBinary(const UA_ByteString *src, UA_ByteString *dst, size_t *offset) {
1016  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTESTRING], NULL, NULL, dst, offset);
1017 }
1018 static UA_INLINE UA_StatusCode
1019 UA_ByteString_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ByteString *dst) {
1020  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTESTRING]);
1021 }
1022 
1023 /* XmlElement */
1024 static UA_INLINE UA_StatusCode
1025 UA_XmlElement_encodeBinary(const UA_XmlElement *src, UA_ByteString *dst, size_t *offset) {
1026  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_XMLELEMENT], NULL, NULL, dst, offset);
1027 }
1028 static UA_INLINE UA_StatusCode
1029 UA_XmlElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_XmlElement *dst) {
1030  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_XMLELEMENT]);
1031 }
1032 
1033 /* NodeId */
1034 static UA_INLINE UA_StatusCode
1035 UA_NodeId_encodeBinary(const UA_NodeId *src, UA_ByteString *dst, size_t *offset) {
1036  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEID], NULL, NULL, dst, offset);
1037 }
1038 static UA_INLINE UA_StatusCode
1039 UA_NodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeId *dst) {
1040  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEID]);
1041 }
1042 
1043 /* ExpandedNodeId */
1044 static UA_INLINE UA_StatusCode
1045 UA_ExpandedNodeId_encodeBinary(const UA_ExpandedNodeId *src, UA_ByteString *dst, size_t *offset) {
1046  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXPANDEDNODEID], NULL, NULL, dst, offset);
1047 }
1048 static UA_INLINE UA_StatusCode
1049 UA_ExpandedNodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ExpandedNodeId *dst) {
1050  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]);
1051 }
1052 
1053 /* StatusCode */
1054 static UA_INLINE UA_StatusCode
1055 UA_StatusCode_encodeBinary(const UA_StatusCode *src, UA_ByteString *dst, size_t *offset) {
1056  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STATUSCODE], NULL, NULL, dst, offset);
1057 }
1058 static UA_INLINE UA_StatusCode
1059 UA_StatusCode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_StatusCode *dst) {
1060  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STATUSCODE]);
1061 }
1062 
1063 /* QualifiedName */
1064 static UA_INLINE UA_StatusCode
1065 UA_QualifiedName_encodeBinary(const UA_QualifiedName *src, UA_ByteString *dst, size_t *offset) {
1066  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUALIFIEDNAME], NULL, NULL, dst, offset);
1067 }
1068 static UA_INLINE UA_StatusCode
1069 UA_QualifiedName_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QualifiedName *dst) {
1070  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
1071 }
1072 
1073 /* LocalizedText */
1074 static UA_INLINE UA_StatusCode
1075 UA_LocalizedText_encodeBinary(const UA_LocalizedText *src, UA_ByteString *dst, size_t *offset) {
1076  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], NULL, NULL, dst, offset);
1077 }
1078 static UA_INLINE UA_StatusCode
1079 UA_LocalizedText_decodeBinary(const UA_ByteString *src, size_t *offset, UA_LocalizedText *dst) {
1080  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
1081 }
1082 
1083 /* ExtensionObject */
1084 static UA_INLINE UA_StatusCode
1085 UA_ExtensionObject_encodeBinary(const UA_ExtensionObject *src, UA_ByteString *dst, size_t *offset) {
1086  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT], NULL, NULL, dst, offset);
1087 }
1088 static UA_INLINE UA_StatusCode
1089 UA_ExtensionObject_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ExtensionObject *dst) {
1090  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);
1091 }
1092 
1093 /* DataValue */
1094 static UA_INLINE UA_StatusCode
1095 UA_DataValue_encodeBinary(const UA_DataValue *src, UA_ByteString *dst, size_t *offset) {
1096  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATAVALUE], NULL, NULL, dst, offset);
1097 }
1098 static UA_INLINE UA_StatusCode
1099 UA_DataValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataValue *dst) {
1100  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATAVALUE]);
1101 }
1102 
1103 /* Variant */
1104 static UA_INLINE UA_StatusCode
1105 UA_Variant_encodeBinary(const UA_Variant *src, UA_ByteString *dst, size_t *offset) {
1106  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIANT], NULL, NULL, dst, offset);
1107 }
1108 static UA_INLINE UA_StatusCode
1109 UA_Variant_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Variant *dst) {
1110  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIANT]);
1111 }
1112 
1113 /* DiagnosticInfo */
1114 static UA_INLINE UA_StatusCode
1115 UA_DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, UA_ByteString *dst, size_t *offset) {
1116  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO], NULL, NULL, dst, offset);
1117 }
1118 static UA_INLINE UA_StatusCode
1119 UA_DiagnosticInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DiagnosticInfo *dst) {
1120  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO]);
1121 }
1122 
1123 /* SignedSoftwareCertificate */
1124 static UA_INLINE UA_StatusCode
1125 UA_SignedSoftwareCertificate_encodeBinary(const UA_SignedSoftwareCertificate *src, UA_ByteString *dst, size_t *offset) {
1127 }
1128 static UA_INLINE UA_StatusCode
1129 UA_SignedSoftwareCertificate_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SignedSoftwareCertificate *dst) {
1130  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE]);
1131 }
1132 
1133 /* BrowsePathTarget */
1134 static UA_INLINE UA_StatusCode
1135 UA_BrowsePathTarget_encodeBinary(const UA_BrowsePathTarget *src, UA_ByteString *dst, size_t *offset) {
1136  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET], NULL, NULL, dst, offset);
1137 }
1138 static UA_INLINE UA_StatusCode
1139 UA_BrowsePathTarget_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePathTarget *dst) {
1140  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET]);
1141 }
1142 
1143 /* ViewAttributes */
1144 static UA_INLINE UA_StatusCode
1145 UA_ViewAttributes_encodeBinary(const UA_ViewAttributes *src, UA_ByteString *dst, size_t *offset) {
1146  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], NULL, NULL, dst, offset);
1147 }
1148 static UA_INLINE UA_StatusCode
1149 UA_ViewAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ViewAttributes *dst) {
1150  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES]);
1151 }
1152 
1153 /* BrowseResultMask */
1154 static UA_INLINE UA_StatusCode
1155 UA_BrowseResultMask_encodeBinary(const UA_BrowseResultMask *src, UA_ByteString *dst, size_t *offset) {
1156  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULTMASK], NULL, NULL, dst, offset);
1157 }
1158 static UA_INLINE UA_StatusCode
1159 UA_BrowseResultMask_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResultMask *dst) {
1160  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULTMASK]);
1161 }
1162 
1163 /* RequestHeader */
1164 static UA_INLINE UA_StatusCode
1165 UA_RequestHeader_encodeBinary(const UA_RequestHeader *src, UA_ByteString *dst, size_t *offset) {
1166  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REQUESTHEADER], NULL, NULL, dst, offset);
1167 }
1168 static UA_INLINE UA_StatusCode
1169 UA_RequestHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RequestHeader *dst) {
1170  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REQUESTHEADER]);
1171 }
1172 
1173 /* MonitoredItemModifyResult */
1174 static UA_INLINE UA_StatusCode
1175 UA_MonitoredItemModifyResult_encodeBinary(const UA_MonitoredItemModifyResult *src, UA_ByteString *dst, size_t *offset) {
1177 }
1178 static UA_INLINE UA_StatusCode
1179 UA_MonitoredItemModifyResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemModifyResult *dst) {
1180  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]);
1181 }
1182 
1183 /* CloseSecureChannelRequest */
1184 static UA_INLINE UA_StatusCode
1185 UA_CloseSecureChannelRequest_encodeBinary(const UA_CloseSecureChannelRequest *src, UA_ByteString *dst, size_t *offset) {
1187 }
1188 static UA_INLINE UA_StatusCode
1189 UA_CloseSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSecureChannelRequest *dst) {
1190  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]);
1191 }
1192 
1193 /* AddNodesResult */
1194 static UA_INLINE UA_StatusCode
1195 UA_AddNodesResult_encodeBinary(const UA_AddNodesResult *src, UA_ByteString *dst, size_t *offset) {
1196  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESULT], NULL, NULL, dst, offset);
1197 }
1198 static UA_INLINE UA_StatusCode
1199 UA_AddNodesResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesResult *dst) {
1200  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESULT]);
1201 }
1202 
1203 /* VariableAttributes */
1204 static UA_INLINE UA_StatusCode
1205 UA_VariableAttributes_encodeBinary(const UA_VariableAttributes *src, UA_ByteString *dst, size_t *offset) {
1206  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], NULL, NULL, dst, offset);
1207 }
1208 static UA_INLINE UA_StatusCode
1209 UA_VariableAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_VariableAttributes *dst) {
1210  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]);
1211 }
1212 
1213 /* NotificationMessage */
1214 static UA_INLINE UA_StatusCode
1215 UA_NotificationMessage_encodeBinary(const UA_NotificationMessage *src, UA_ByteString *dst, size_t *offset) {
1216  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE], NULL, NULL, dst, offset);
1217 }
1218 static UA_INLINE UA_StatusCode
1219 UA_NotificationMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NotificationMessage *dst) {
1220  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE]);
1221 }
1222 
1223 /* NodeAttributesMask */
1224 static UA_INLINE UA_StatusCode
1225 UA_NodeAttributesMask_encodeBinary(const UA_NodeAttributesMask *src, UA_ByteString *dst, size_t *offset) {
1226  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK], NULL, NULL, dst, offset);
1227 }
1228 static UA_INLINE UA_StatusCode
1229 UA_NodeAttributesMask_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeAttributesMask *dst) {
1230  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK]);
1231 }
1232 
1233 /* MonitoringMode */
1234 static UA_INLINE UA_StatusCode
1235 UA_MonitoringMode_encodeBinary(const UA_MonitoringMode *src, UA_ByteString *dst, size_t *offset) {
1236  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGMODE], NULL, NULL, dst, offset);
1237 }
1238 static UA_INLINE UA_StatusCode
1239 UA_MonitoringMode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoringMode *dst) {
1240  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGMODE]);
1241 }
1242 
1243 /* CallMethodResult */
1244 static UA_INLINE UA_StatusCode
1245 UA_CallMethodResult_encodeBinary(const UA_CallMethodResult *src, UA_ByteString *dst, size_t *offset) {
1246  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODRESULT], NULL, NULL, dst, offset);
1247 }
1248 static UA_INLINE UA_StatusCode
1249 UA_CallMethodResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallMethodResult *dst) {
1250  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODRESULT]);
1251 }
1252 
1253 /* ParsingResult */
1254 static UA_INLINE UA_StatusCode
1255 UA_ParsingResult_encodeBinary(const UA_ParsingResult *src, UA_ByteString *dst, size_t *offset) {
1256  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PARSINGRESULT], NULL, NULL, dst, offset);
1257 }
1258 static UA_INLINE UA_StatusCode
1259 UA_ParsingResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ParsingResult *dst) {
1260  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PARSINGRESULT]);
1261 }
1262 
1263 /* RelativePathElement */
1264 static UA_INLINE UA_StatusCode
1265 UA_RelativePathElement_encodeBinary(const UA_RelativePathElement *src, UA_ByteString *dst, size_t *offset) {
1266  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT], NULL, NULL, dst, offset);
1267 }
1268 static UA_INLINE UA_StatusCode
1269 UA_RelativePathElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RelativePathElement *dst) {
1270  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]);
1271 }
1272 
1273 /* BrowseDirection */
1274 static UA_INLINE UA_StatusCode
1275 UA_BrowseDirection_encodeBinary(const UA_BrowseDirection *src, UA_ByteString *dst, size_t *offset) {
1276  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDIRECTION], NULL, NULL, dst, offset);
1277 }
1278 static UA_INLINE UA_StatusCode
1279 UA_BrowseDirection_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseDirection *dst) {
1280  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDIRECTION]);
1281 }
1282 
1283 /* CallMethodRequest */
1284 static UA_INLINE UA_StatusCode
1285 UA_CallMethodRequest_encodeBinary(const UA_CallMethodRequest *src, UA_ByteString *dst, size_t *offset) {
1286  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST], NULL, NULL, dst, offset);
1287 }
1288 static UA_INLINE UA_StatusCode
1289 UA_CallMethodRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallMethodRequest *dst) {
1290  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST]);
1291 }
1292 
1293 /* UnregisterNodesRequest */
1294 static UA_INLINE UA_StatusCode
1295 UA_UnregisterNodesRequest_encodeBinary(const UA_UnregisterNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1296  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST], NULL, NULL, dst, offset);
1297 }
1298 static UA_INLINE UA_StatusCode
1299 UA_UnregisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UnregisterNodesRequest *dst) {
1300  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]);
1301 }
1302 
1303 /* ContentFilterElementResult */
1304 static UA_INLINE UA_StatusCode
1305 UA_ContentFilterElementResult_encodeBinary(const UA_ContentFilterElementResult *src, UA_ByteString *dst, size_t *offset) {
1307 }
1308 static UA_INLINE UA_StatusCode
1309 UA_ContentFilterElementResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterElementResult *dst) {
1310  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT]);
1311 }
1312 
1313 /* QueryDataSet */
1314 static UA_INLINE UA_StatusCode
1315 UA_QueryDataSet_encodeBinary(const UA_QueryDataSet *src, UA_ByteString *dst, size_t *offset) {
1316  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATASET], NULL, NULL, dst, offset);
1317 }
1318 static UA_INLINE UA_StatusCode
1319 UA_QueryDataSet_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryDataSet *dst) {
1320  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATASET]);
1321 }
1322 
1323 /* AnonymousIdentityToken */
1324 static UA_INLINE UA_StatusCode
1325 UA_AnonymousIdentityToken_encodeBinary(const UA_AnonymousIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1326  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN], NULL, NULL, dst, offset);
1327 }
1328 static UA_INLINE UA_StatusCode
1329 UA_AnonymousIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AnonymousIdentityToken *dst) {
1330  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]);
1331 }
1332 
1333 /* SetPublishingModeRequest */
1334 static UA_INLINE UA_StatusCode
1335 UA_SetPublishingModeRequest_encodeBinary(const UA_SetPublishingModeRequest *src, UA_ByteString *dst, size_t *offset) {
1336  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST], NULL, NULL, dst, offset);
1337 }
1338 static UA_INLINE UA_StatusCode
1339 UA_SetPublishingModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetPublishingModeRequest *dst) {
1340  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]);
1341 }
1342 
1343 /* TimestampsToReturn */
1344 static UA_INLINE UA_StatusCode
1345 UA_TimestampsToReturn_encodeBinary(const UA_TimestampsToReturn *src, UA_ByteString *dst, size_t *offset) {
1346  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN], NULL, NULL, dst, offset);
1347 }
1348 static UA_INLINE UA_StatusCode
1349 UA_TimestampsToReturn_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TimestampsToReturn *dst) {
1350  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN]);
1351 }
1352 
1353 /* CallRequest */
1354 static UA_INLINE UA_StatusCode
1355 UA_CallRequest_encodeBinary(const UA_CallRequest *src, UA_ByteString *dst, size_t *offset) {
1356  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLREQUEST], NULL, NULL, dst, offset);
1357 }
1358 static UA_INLINE UA_StatusCode
1359 UA_CallRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallRequest *dst) {
1360  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLREQUEST]);
1361 }
1362 
1363 /* MethodAttributes */
1364 static UA_INLINE UA_StatusCode
1365 UA_MethodAttributes_encodeBinary(const UA_MethodAttributes *src, UA_ByteString *dst, size_t *offset) {
1366  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_METHODATTRIBUTES], NULL, NULL, dst, offset);
1367 }
1368 static UA_INLINE UA_StatusCode
1369 UA_MethodAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MethodAttributes *dst) {
1370  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_METHODATTRIBUTES]);
1371 }
1372 
1373 /* DeleteReferencesItem */
1374 static UA_INLINE UA_StatusCode
1375 UA_DeleteReferencesItem_encodeBinary(const UA_DeleteReferencesItem *src, UA_ByteString *dst, size_t *offset) {
1376  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM], NULL, NULL, dst, offset);
1377 }
1378 static UA_INLINE UA_StatusCode
1379 UA_DeleteReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesItem *dst) {
1380  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM]);
1381 }
1382 
1383 /* WriteValue */
1384 static UA_INLINE UA_StatusCode
1385 UA_WriteValue_encodeBinary(const UA_WriteValue *src, UA_ByteString *dst, size_t *offset) {
1386  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEVALUE], NULL, NULL, dst, offset);
1387 }
1388 static UA_INLINE UA_StatusCode
1389 UA_WriteValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteValue *dst) {
1390  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEVALUE]);
1391 }
1392 
1393 /* MonitoredItemCreateResult */
1394 static UA_INLINE UA_StatusCode
1395 UA_MonitoredItemCreateResult_encodeBinary(const UA_MonitoredItemCreateResult *src, UA_ByteString *dst, size_t *offset) {
1397 }
1398 static UA_INLINE UA_StatusCode
1399 UA_MonitoredItemCreateResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemCreateResult *dst) {
1400  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]);
1401 }
1402 
1403 /* MessageSecurityMode */
1404 static UA_INLINE UA_StatusCode
1405 UA_MessageSecurityMode_encodeBinary(const UA_MessageSecurityMode *src, UA_ByteString *dst, size_t *offset) {
1406  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE], NULL, NULL, dst, offset);
1407 }
1408 static UA_INLINE UA_StatusCode
1409 UA_MessageSecurityMode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MessageSecurityMode *dst) {
1410  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE]);
1411 }
1412 
1413 /* MonitoringParameters */
1414 static UA_INLINE UA_StatusCode
1415 UA_MonitoringParameters_encodeBinary(const UA_MonitoringParameters *src, UA_ByteString *dst, size_t *offset) {
1416  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS], NULL, NULL, dst, offset);
1417 }
1418 static UA_INLINE UA_StatusCode
1419 UA_MonitoringParameters_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoringParameters *dst) {
1420  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS]);
1421 }
1422 
1423 /* SignatureData */
1424 static UA_INLINE UA_StatusCode
1425 UA_SignatureData_encodeBinary(const UA_SignatureData *src, UA_ByteString *dst, size_t *offset) {
1426  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SIGNATUREDATA], NULL, NULL, dst, offset);
1427 }
1428 static UA_INLINE UA_StatusCode
1429 UA_SignatureData_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SignatureData *dst) {
1430  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNATUREDATA]);
1431 }
1432 
1433 /* ReferenceNode */
1434 static UA_INLINE UA_StatusCode
1435 UA_ReferenceNode_encodeBinary(const UA_ReferenceNode *src, UA_ByteString *dst, size_t *offset) {
1436  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCENODE], NULL, NULL, dst, offset);
1437 }
1438 static UA_INLINE UA_StatusCode
1439 UA_ReferenceNode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceNode *dst) {
1440  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCENODE]);
1441 }
1442 
1443 /* Argument */
1444 static UA_INLINE UA_StatusCode
1445 UA_Argument_encodeBinary(const UA_Argument *src, UA_ByteString *dst, size_t *offset) {
1446  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ARGUMENT], NULL, NULL, dst, offset);
1447 }
1448 static UA_INLINE UA_StatusCode
1449 UA_Argument_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Argument *dst) {
1450  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ARGUMENT]);
1451 }
1452 
1453 /* UserIdentityToken */
1454 static UA_INLINE UA_StatusCode
1455 UA_UserIdentityToken_encodeBinary(const UA_UserIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1456  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN], NULL, NULL, dst, offset);
1457 }
1458 static UA_INLINE UA_StatusCode
1459 UA_UserIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserIdentityToken *dst) {
1460  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN]);
1461 }
1462 
1463 /* ObjectTypeAttributes */
1464 static UA_INLINE UA_StatusCode
1465 UA_ObjectTypeAttributes_encodeBinary(const UA_ObjectTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1466  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], NULL, NULL, dst, offset);
1467 }
1468 static UA_INLINE UA_StatusCode
1469 UA_ObjectTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ObjectTypeAttributes *dst) {
1470  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]);
1471 }
1472 
1473 /* DeadbandType */
1474 static UA_INLINE UA_StatusCode
1475 UA_DeadbandType_encodeBinary(const UA_DeadbandType *src, UA_ByteString *dst, size_t *offset) {
1476  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DEADBANDTYPE], NULL, NULL, dst, offset);
1477 }
1478 static UA_INLINE UA_StatusCode
1479 UA_DeadbandType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeadbandType *dst) {
1480  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DEADBANDTYPE]);
1481 }
1482 
1483 /* SecurityTokenRequestType */
1484 static UA_INLINE UA_StatusCode
1485 UA_SecurityTokenRequestType_encodeBinary(const UA_SecurityTokenRequestType *src, UA_ByteString *dst, size_t *offset) {
1486  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE], NULL, NULL, dst, offset);
1487 }
1488 static UA_INLINE UA_StatusCode
1489 UA_SecurityTokenRequestType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecurityTokenRequestType *dst) {
1490  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE]);
1491 }
1492 
1493 /* DataChangeTrigger */
1494 static UA_INLINE UA_StatusCode
1495 UA_DataChangeTrigger_encodeBinary(const UA_DataChangeTrigger *src, UA_ByteString *dst, size_t *offset) {
1496  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER], NULL, NULL, dst, offset);
1497 }
1498 static UA_INLINE UA_StatusCode
1499 UA_DataChangeTrigger_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeTrigger *dst) {
1500  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER]);
1501 }
1502 
1503 /* BuildInfo */
1504 static UA_INLINE UA_StatusCode
1505 UA_BuildInfo_encodeBinary(const UA_BuildInfo *src, UA_ByteString *dst, size_t *offset) {
1506  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BUILDINFO], NULL, NULL, dst, offset);
1507 }
1508 static UA_INLINE UA_StatusCode
1509 UA_BuildInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BuildInfo *dst) {
1510  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BUILDINFO]);
1511 }
1512 
1513 /* NodeClass */
1514 static UA_INLINE UA_StatusCode
1515 UA_NodeClass_encodeBinary(const UA_NodeClass *src, UA_ByteString *dst, size_t *offset) {
1516  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODECLASS], NULL, NULL, dst, offset);
1517 }
1518 static UA_INLINE UA_StatusCode
1519 UA_NodeClass_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeClass *dst) {
1520  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODECLASS]);
1521 }
1522 
1523 /* ChannelSecurityToken */
1524 static UA_INLINE UA_StatusCode
1525 UA_ChannelSecurityToken_encodeBinary(const UA_ChannelSecurityToken *src, UA_ByteString *dst, size_t *offset) {
1526  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN], NULL, NULL, dst, offset);
1527 }
1528 static UA_INLINE UA_StatusCode
1529 UA_ChannelSecurityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChannelSecurityToken *dst) {
1530  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN]);
1531 }
1532 
1533 /* MonitoredItemNotification */
1534 static UA_INLINE UA_StatusCode
1535 UA_MonitoredItemNotification_encodeBinary(const UA_MonitoredItemNotification *src, UA_ByteString *dst, size_t *offset) {
1537 }
1538 static UA_INLINE UA_StatusCode
1539 UA_MonitoredItemNotification_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemNotification *dst) {
1540  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]);
1541 }
1542 
1543 /* DeleteNodesItem */
1544 static UA_INLINE UA_StatusCode
1545 UA_DeleteNodesItem_encodeBinary(const UA_DeleteNodesItem *src, UA_ByteString *dst, size_t *offset) {
1546  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESITEM], NULL, NULL, dst, offset);
1547 }
1548 static UA_INLINE UA_StatusCode
1549 UA_DeleteNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesItem *dst) {
1550  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESITEM]);
1551 }
1552 
1553 /* SubscriptionAcknowledgement */
1554 static UA_INLINE UA_StatusCode
1555 UA_SubscriptionAcknowledgement_encodeBinary(const UA_SubscriptionAcknowledgement *src, UA_ByteString *dst, size_t *offset) {
1557 }
1558 static UA_INLINE UA_StatusCode
1559 UA_SubscriptionAcknowledgement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SubscriptionAcknowledgement *dst) {
1561 }
1562 
1563 /* ReadValueId */
1564 static UA_INLINE UA_StatusCode
1565 UA_ReadValueId_encodeBinary(const UA_ReadValueId *src, UA_ByteString *dst, size_t *offset) {
1566  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READVALUEID], NULL, NULL, dst, offset);
1567 }
1568 static UA_INLINE UA_StatusCode
1569 UA_ReadValueId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadValueId *dst) {
1570  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READVALUEID]);
1571 }
1572 
1573 /* DataTypeAttributes */
1574 static UA_INLINE UA_StatusCode
1575 UA_DataTypeAttributes_encodeBinary(const UA_DataTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1576  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], NULL, NULL, dst, offset);
1577 }
1578 static UA_INLINE UA_StatusCode
1579 UA_DataTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataTypeAttributes *dst) {
1580  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]);
1581 }
1582 
1583 /* ResponseHeader */
1584 static UA_INLINE UA_StatusCode
1585 UA_ResponseHeader_encodeBinary(const UA_ResponseHeader *src, UA_ByteString *dst, size_t *offset) {
1586  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RESPONSEHEADER], NULL, NULL, dst, offset);
1587 }
1588 static UA_INLINE UA_StatusCode
1589 UA_ResponseHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ResponseHeader *dst) {
1590  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RESPONSEHEADER]);
1591 }
1592 
1593 /* DeleteSubscriptionsRequest */
1594 static UA_INLINE UA_StatusCode
1595 UA_DeleteSubscriptionsRequest_encodeBinary(const UA_DeleteSubscriptionsRequest *src, UA_ByteString *dst, size_t *offset) {
1597 }
1598 static UA_INLINE UA_StatusCode
1599 UA_DeleteSubscriptionsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteSubscriptionsRequest *dst) {
1600  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]);
1601 }
1602 
1603 /* ViewDescription */
1604 static UA_INLINE UA_StatusCode
1605 UA_ViewDescription_encodeBinary(const UA_ViewDescription *src, UA_ByteString *dst, size_t *offset) {
1606  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION], NULL, NULL, dst, offset);
1607 }
1608 static UA_INLINE UA_StatusCode
1609 UA_ViewDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ViewDescription *dst) {
1610  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION]);
1611 }
1612 
1613 /* DeleteMonitoredItemsResponse */
1614 static UA_INLINE UA_StatusCode
1615 UA_DeleteMonitoredItemsResponse_encodeBinary(const UA_DeleteMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
1617 }
1618 static UA_INLINE UA_StatusCode
1619 UA_DeleteMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteMonitoredItemsResponse *dst) {
1621 }
1622 
1623 /* NodeAttributes */
1624 static UA_INLINE UA_StatusCode
1625 UA_NodeAttributes_encodeBinary(const UA_NodeAttributes *src, UA_ByteString *dst, size_t *offset) {
1626  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTES], NULL, NULL, dst, offset);
1627 }
1628 static UA_INLINE UA_StatusCode
1629 UA_NodeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeAttributes *dst) {
1630  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTES]);
1631 }
1632 
1633 /* RegisterNodesRequest */
1634 static UA_INLINE UA_StatusCode
1635 UA_RegisterNodesRequest_encodeBinary(const UA_RegisterNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1636  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST], NULL, NULL, dst, offset);
1637 }
1638 static UA_INLINE UA_StatusCode
1639 UA_RegisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RegisterNodesRequest *dst) {
1640  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]);
1641 }
1642 
1643 /* DeleteNodesRequest */
1644 static UA_INLINE UA_StatusCode
1645 UA_DeleteNodesRequest_encodeBinary(const UA_DeleteNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1646  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESREQUEST], NULL, NULL, dst, offset);
1647 }
1648 static UA_INLINE UA_StatusCode
1649 UA_DeleteNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesRequest *dst) {
1650  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESREQUEST]);
1651 }
1652 
1653 /* PublishResponse */
1654 static UA_INLINE UA_StatusCode
1655 UA_PublishResponse_encodeBinary(const UA_PublishResponse *src, UA_ByteString *dst, size_t *offset) {
1656  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE], NULL, NULL, dst, offset);
1657 }
1658 static UA_INLINE UA_StatusCode
1659 UA_PublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_PublishResponse *dst) {
1660  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]);
1661 }
1662 
1663 /* MonitoredItemModifyRequest */
1664 static UA_INLINE UA_StatusCode
1665 UA_MonitoredItemModifyRequest_encodeBinary(const UA_MonitoredItemModifyRequest *src, UA_ByteString *dst, size_t *offset) {
1667 }
1668 static UA_INLINE UA_StatusCode
1669 UA_MonitoredItemModifyRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemModifyRequest *dst) {
1670  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST]);
1671 }
1672 
1673 /* UserNameIdentityToken */
1674 static UA_INLINE UA_StatusCode
1675 UA_UserNameIdentityToken_encodeBinary(const UA_UserNameIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1676  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN], NULL, NULL, dst, offset);
1677 }
1678 static UA_INLINE UA_StatusCode
1679 UA_UserNameIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserNameIdentityToken *dst) {
1680  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]);
1681 }
1682 
1683 /* IdType */
1684 static UA_INLINE UA_StatusCode
1685 UA_IdType_encodeBinary(const UA_IdType *src, UA_ByteString *dst, size_t *offset) {
1686  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_IDTYPE], NULL, NULL, dst, offset);
1687 }
1688 static UA_INLINE UA_StatusCode
1689 UA_IdType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_IdType *dst) {
1690  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_IDTYPE]);
1691 }
1692 
1693 /* UserTokenType */
1694 static UA_INLINE UA_StatusCode
1695 UA_UserTokenType_encodeBinary(const UA_UserTokenType *src, UA_ByteString *dst, size_t *offset) {
1696  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENTYPE], NULL, NULL, dst, offset);
1697 }
1698 static UA_INLINE UA_StatusCode
1699 UA_UserTokenType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserTokenType *dst) {
1700  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENTYPE]);
1701 }
1702 
1703 /* ActivateSessionRequest */
1704 static UA_INLINE UA_StatusCode
1705 UA_ActivateSessionRequest_encodeBinary(const UA_ActivateSessionRequest *src, UA_ByteString *dst, size_t *offset) {
1706  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST], NULL, NULL, dst, offset);
1707 }
1708 static UA_INLINE UA_StatusCode
1709 UA_ActivateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ActivateSessionRequest *dst) {
1710  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]);
1711 }
1712 
1713 /* OpenSecureChannelResponse */
1714 static UA_INLINE UA_StatusCode
1715 UA_OpenSecureChannelResponse_encodeBinary(const UA_OpenSecureChannelResponse *src, UA_ByteString *dst, size_t *offset) {
1717 }
1718 static UA_INLINE UA_StatusCode
1719 UA_OpenSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_OpenSecureChannelResponse *dst) {
1720  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]);
1721 }
1722 
1723 /* ApplicationType */
1724 static UA_INLINE UA_StatusCode
1725 UA_ApplicationType_encodeBinary(const UA_ApplicationType *src, UA_ByteString *dst, size_t *offset) {
1726  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONTYPE], NULL, NULL, dst, offset);
1727 }
1728 static UA_INLINE UA_StatusCode
1729 UA_ApplicationType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ApplicationType *dst) {
1730  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONTYPE]);
1731 }
1732 
1733 /* ServerState */
1734 static UA_INLINE UA_StatusCode
1735 UA_ServerState_encodeBinary(const UA_ServerState *src, UA_ByteString *dst, size_t *offset) {
1736  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATE], NULL, NULL, dst, offset);
1737 }
1738 static UA_INLINE UA_StatusCode
1739 UA_ServerState_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServerState *dst) {
1740  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATE]);
1741 }
1742 
1743 /* QueryNextResponse */
1744 static UA_INLINE UA_StatusCode
1745 UA_QueryNextResponse_encodeBinary(const UA_QueryNextResponse *src, UA_ByteString *dst, size_t *offset) {
1746  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE], NULL, NULL, dst, offset);
1747 }
1748 static UA_INLINE UA_StatusCode
1749 UA_QueryNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryNextResponse *dst) {
1750  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE]);
1751 }
1752 
1753 /* ActivateSessionResponse */
1754 static UA_INLINE UA_StatusCode
1755 UA_ActivateSessionResponse_encodeBinary(const UA_ActivateSessionResponse *src, UA_ByteString *dst, size_t *offset) {
1756  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE], NULL, NULL, dst, offset);
1757 }
1758 static UA_INLINE UA_StatusCode
1759 UA_ActivateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ActivateSessionResponse *dst) {
1760  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]);
1761 }
1762 
1763 /* FilterOperator */
1764 static UA_INLINE UA_StatusCode
1765 UA_FilterOperator_encodeBinary(const UA_FilterOperator *src, UA_ByteString *dst, size_t *offset) {
1766  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FILTEROPERATOR], NULL, NULL, dst, offset);
1767 }
1768 static UA_INLINE UA_StatusCode
1769 UA_FilterOperator_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FilterOperator *dst) {
1770  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FILTEROPERATOR]);
1771 }
1772 
1773 /* QueryNextRequest */
1774 static UA_INLINE UA_StatusCode
1775 UA_QueryNextRequest_encodeBinary(const UA_QueryNextRequest *src, UA_ByteString *dst, size_t *offset) {
1776  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST], NULL, NULL, dst, offset);
1777 }
1778 static UA_INLINE UA_StatusCode
1779 UA_QueryNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryNextRequest *dst) {
1780  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST]);
1781 }
1782 
1783 /* WriteResponse */
1784 static UA_INLINE UA_StatusCode
1785 UA_WriteResponse_encodeBinary(const UA_WriteResponse *src, UA_ByteString *dst, size_t *offset) {
1786  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITERESPONSE], NULL, NULL, dst, offset);
1787 }
1788 static UA_INLINE UA_StatusCode
1789 UA_WriteResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteResponse *dst) {
1790  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITERESPONSE]);
1791 }
1792 
1793 /* BrowseNextRequest */
1794 static UA_INLINE UA_StatusCode
1795 UA_BrowseNextRequest_encodeBinary(const UA_BrowseNextRequest *src, UA_ByteString *dst, size_t *offset) {
1796  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST], NULL, NULL, dst, offset);
1797 }
1798 static UA_INLINE UA_StatusCode
1799 UA_BrowseNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseNextRequest *dst) {
1800  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]);
1801 }
1802 
1803 /* CreateSubscriptionRequest */
1804 static UA_INLINE UA_StatusCode
1805 UA_CreateSubscriptionRequest_encodeBinary(const UA_CreateSubscriptionRequest *src, UA_ByteString *dst, size_t *offset) {
1807 }
1808 static UA_INLINE UA_StatusCode
1809 UA_CreateSubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSubscriptionRequest *dst) {
1810  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]);
1811 }
1812 
1813 /* VariableTypeAttributes */
1814 static UA_INLINE UA_StatusCode
1815 UA_VariableTypeAttributes_encodeBinary(const UA_VariableTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1816  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], NULL, NULL, dst, offset);
1817 }
1818 static UA_INLINE UA_StatusCode
1819 UA_VariableTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_VariableTypeAttributes *dst) {
1820  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]);
1821 }
1822 
1823 /* BrowsePathResult */
1824 static UA_INLINE UA_StatusCode
1825 UA_BrowsePathResult_encodeBinary(const UA_BrowsePathResult *src, UA_ByteString *dst, size_t *offset) {
1826  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT], NULL, NULL, dst, offset);
1827 }
1828 static UA_INLINE UA_StatusCode
1829 UA_BrowsePathResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePathResult *dst) {
1830  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT]);
1831 }
1832 
1833 /* ModifySubscriptionResponse */
1834 static UA_INLINE UA_StatusCode
1835 UA_ModifySubscriptionResponse_encodeBinary(const UA_ModifySubscriptionResponse *src, UA_ByteString *dst, size_t *offset) {
1837 }
1838 static UA_INLINE UA_StatusCode
1839 UA_ModifySubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifySubscriptionResponse *dst) {
1840  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]);
1841 }
1842 
1843 /* OpenSecureChannelRequest */
1844 static UA_INLINE UA_StatusCode
1845 UA_OpenSecureChannelRequest_encodeBinary(const UA_OpenSecureChannelRequest *src, UA_ByteString *dst, size_t *offset) {
1846  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST], NULL, NULL, dst, offset);
1847 }
1848 static UA_INLINE UA_StatusCode
1849 UA_OpenSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_OpenSecureChannelRequest *dst) {
1850  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]);
1851 }
1852 
1853 /* RegisterNodesResponse */
1854 static UA_INLINE UA_StatusCode
1855 UA_RegisterNodesResponse_encodeBinary(const UA_RegisterNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1856  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE], NULL, NULL, dst, offset);
1857 }
1858 static UA_INLINE UA_StatusCode
1859 UA_RegisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RegisterNodesResponse *dst) {
1860  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]);
1861 }
1862 
1863 /* CloseSessionRequest */
1864 static UA_INLINE UA_StatusCode
1865 UA_CloseSessionRequest_encodeBinary(const UA_CloseSessionRequest *src, UA_ByteString *dst, size_t *offset) {
1866  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST], NULL, NULL, dst, offset);
1867 }
1868 static UA_INLINE UA_StatusCode
1869 UA_CloseSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSessionRequest *dst) {
1870  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]);
1871 }
1872 
1873 /* ModifySubscriptionRequest */
1874 static UA_INLINE UA_StatusCode
1875 UA_ModifySubscriptionRequest_encodeBinary(const UA_ModifySubscriptionRequest *src, UA_ByteString *dst, size_t *offset) {
1877 }
1878 static UA_INLINE UA_StatusCode
1879 UA_ModifySubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifySubscriptionRequest *dst) {
1880  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]);
1881 }
1882 
1883 /* UserTokenPolicy */
1884 static UA_INLINE UA_StatusCode
1885 UA_UserTokenPolicy_encodeBinary(const UA_UserTokenPolicy *src, UA_ByteString *dst, size_t *offset) {
1886  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENPOLICY], NULL, NULL, dst, offset);
1887 }
1888 static UA_INLINE UA_StatusCode
1889 UA_UserTokenPolicy_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserTokenPolicy *dst) {
1890  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
1891 }
1892 
1893 /* DeleteMonitoredItemsRequest */
1894 static UA_INLINE UA_StatusCode
1895 UA_DeleteMonitoredItemsRequest_encodeBinary(const UA_DeleteMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
1897 }
1898 static UA_INLINE UA_StatusCode
1899 UA_DeleteMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteMonitoredItemsRequest *dst) {
1901 }
1902 
1903 /* ReferenceTypeAttributes */
1904 static UA_INLINE UA_StatusCode
1905 UA_ReferenceTypeAttributes_encodeBinary(const UA_ReferenceTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1906  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], NULL, NULL, dst, offset);
1907 }
1908 static UA_INLINE UA_StatusCode
1909 UA_ReferenceTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceTypeAttributes *dst) {
1910  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]);
1911 }
1912 
1913 /* SetMonitoringModeRequest */
1914 static UA_INLINE UA_StatusCode
1915 UA_SetMonitoringModeRequest_encodeBinary(const UA_SetMonitoringModeRequest *src, UA_ByteString *dst, size_t *offset) {
1916  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST], NULL, NULL, dst, offset);
1917 }
1918 static UA_INLINE UA_StatusCode
1919 UA_SetMonitoringModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetMonitoringModeRequest *dst) {
1920  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]);
1921 }
1922 
1923 /* UnregisterNodesResponse */
1924 static UA_INLINE UA_StatusCode
1925 UA_UnregisterNodesResponse_encodeBinary(const UA_UnregisterNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1926  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE], NULL, NULL, dst, offset);
1927 }
1928 static UA_INLINE UA_StatusCode
1929 UA_UnregisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UnregisterNodesResponse *dst) {
1930  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]);
1931 }
1932 
1933 /* WriteRequest */
1934 static UA_INLINE UA_StatusCode
1935 UA_WriteRequest_encodeBinary(const UA_WriteRequest *src, UA_ByteString *dst, size_t *offset) {
1936  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEREQUEST], NULL, NULL, dst, offset);
1937 }
1938 static UA_INLINE UA_StatusCode
1939 UA_WriteRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteRequest *dst) {
1940  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEREQUEST]);
1941 }
1942 
1943 /* ObjectAttributes */
1944 static UA_INLINE UA_StatusCode
1945 UA_ObjectAttributes_encodeBinary(const UA_ObjectAttributes *src, UA_ByteString *dst, size_t *offset) {
1946  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], NULL, NULL, dst, offset);
1947 }
1948 static UA_INLINE UA_StatusCode
1949 UA_ObjectAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ObjectAttributes *dst) {
1950  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES]);
1951 }
1952 
1953 /* BrowseDescription */
1954 static UA_INLINE UA_StatusCode
1955 UA_BrowseDescription_encodeBinary(const UA_BrowseDescription *src, UA_ByteString *dst, size_t *offset) {
1956  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION], NULL, NULL, dst, offset);
1957 }
1958 static UA_INLINE UA_StatusCode
1959 UA_BrowseDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseDescription *dst) {
1960  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION]);
1961 }
1962 
1963 /* RepublishRequest */
1964 static UA_INLINE UA_StatusCode
1965 UA_RepublishRequest_encodeBinary(const UA_RepublishRequest *src, UA_ByteString *dst, size_t *offset) {
1966  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST], NULL, NULL, dst, offset);
1967 }
1968 static UA_INLINE UA_StatusCode
1969 UA_RepublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RepublishRequest *dst) {
1970  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST]);
1971 }
1972 
1973 /* GetEndpointsRequest */
1974 static UA_INLINE UA_StatusCode
1975 UA_GetEndpointsRequest_encodeBinary(const UA_GetEndpointsRequest *src, UA_ByteString *dst, size_t *offset) {
1976  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST], NULL, NULL, dst, offset);
1977 }
1978 static UA_INLINE UA_StatusCode
1979 UA_GetEndpointsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_GetEndpointsRequest *dst) {
1980  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]);
1981 }
1982 
1983 /* PublishRequest */
1984 static UA_INLINE UA_StatusCode
1985 UA_PublishRequest_encodeBinary(const UA_PublishRequest *src, UA_ByteString *dst, size_t *offset) {
1986  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHREQUEST], NULL, NULL, dst, offset);
1987 }
1988 static UA_INLINE UA_StatusCode
1989 UA_PublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_PublishRequest *dst) {
1990  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHREQUEST]);
1991 }
1992 
1993 /* AddNodesResponse */
1994 static UA_INLINE UA_StatusCode
1995 UA_AddNodesResponse_encodeBinary(const UA_AddNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1996  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE], NULL, NULL, dst, offset);
1997 }
1998 static UA_INLINE UA_StatusCode
1999 UA_AddNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesResponse *dst) {
2000  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]);
2001 }
2002 
2003 /* DataChangeNotification */
2004 static UA_INLINE UA_StatusCode
2005 UA_DataChangeNotification_encodeBinary(const UA_DataChangeNotification *src, UA_ByteString *dst, size_t *offset) {
2006  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION], NULL, NULL, dst, offset);
2007 }
2008 static UA_INLINE UA_StatusCode
2009 UA_DataChangeNotification_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeNotification *dst) {
2010  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]);
2011 }
2012 
2013 /* CloseSecureChannelResponse */
2014 static UA_INLINE UA_StatusCode
2015 UA_CloseSecureChannelResponse_encodeBinary(const UA_CloseSecureChannelResponse *src, UA_ByteString *dst, size_t *offset) {
2017 }
2018 static UA_INLINE UA_StatusCode
2019 UA_CloseSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSecureChannelResponse *dst) {
2020  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE]);
2021 }
2022 
2023 /* ModifyMonitoredItemsRequest */
2024 static UA_INLINE UA_StatusCode
2025 UA_ModifyMonitoredItemsRequest_encodeBinary(const UA_ModifyMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
2027 }
2028 static UA_INLINE UA_StatusCode
2029 UA_ModifyMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifyMonitoredItemsRequest *dst) {
2031 }
2032 
2033 /* SetMonitoringModeResponse */
2034 static UA_INLINE UA_StatusCode
2035 UA_SetMonitoringModeResponse_encodeBinary(const UA_SetMonitoringModeResponse *src, UA_ByteString *dst, size_t *offset) {
2037 }
2038 static UA_INLINE UA_StatusCode
2039 UA_SetMonitoringModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetMonitoringModeResponse *dst) {
2040  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]);
2041 }
2042 
2043 /* FindServersRequest */
2044 static UA_INLINE UA_StatusCode
2045 UA_FindServersRequest_encodeBinary(const UA_FindServersRequest *src, UA_ByteString *dst, size_t *offset) {
2046  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST], NULL, NULL, dst, offset);
2047 }
2048 static UA_INLINE UA_StatusCode
2049 UA_FindServersRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FindServersRequest *dst) {
2050  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]);
2051 }
2052 
2053 /* ReferenceDescription */
2054 static UA_INLINE UA_StatusCode
2055 UA_ReferenceDescription_encodeBinary(const UA_ReferenceDescription *src, UA_ByteString *dst, size_t *offset) {
2056  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION], NULL, NULL, dst, offset);
2057 }
2058 static UA_INLINE UA_StatusCode
2059 UA_ReferenceDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceDescription *dst) {
2060  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]);
2061 }
2062 
2063 /* SetPublishingModeResponse */
2064 static UA_INLINE UA_StatusCode
2065 UA_SetPublishingModeResponse_encodeBinary(const UA_SetPublishingModeResponse *src, UA_ByteString *dst, size_t *offset) {
2067 }
2068 static UA_INLINE UA_StatusCode
2069 UA_SetPublishingModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetPublishingModeResponse *dst) {
2070  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]);
2071 }
2072 
2073 /* ContentFilterResult */
2074 static UA_INLINE UA_StatusCode
2075 UA_ContentFilterResult_encodeBinary(const UA_ContentFilterResult *src, UA_ByteString *dst, size_t *offset) {
2076  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT], NULL, NULL, dst, offset);
2077 }
2078 static UA_INLINE UA_StatusCode
2079 UA_ContentFilterResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterResult *dst) {
2080  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT]);
2081 }
2082 
2083 /* AddReferencesItem */
2084 static UA_INLINE UA_StatusCode
2085 UA_AddReferencesItem_encodeBinary(const UA_AddReferencesItem *src, UA_ByteString *dst, size_t *offset) {
2086  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM], NULL, NULL, dst, offset);
2087 }
2088 static UA_INLINE UA_StatusCode
2089 UA_AddReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesItem *dst) {
2090  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM]);
2091 }
2092 
2093 /* CreateSubscriptionResponse */
2094 static UA_INLINE UA_StatusCode
2095 UA_CreateSubscriptionResponse_encodeBinary(const UA_CreateSubscriptionResponse *src, UA_ByteString *dst, size_t *offset) {
2097 }
2098 static UA_INLINE UA_StatusCode
2099 UA_CreateSubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSubscriptionResponse *dst) {
2100  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]);
2101 }
2102 
2103 /* DeleteSubscriptionsResponse */
2104 static UA_INLINE UA_StatusCode
2105 UA_DeleteSubscriptionsResponse_encodeBinary(const UA_DeleteSubscriptionsResponse *src, UA_ByteString *dst, size_t *offset) {
2107 }
2108 static UA_INLINE UA_StatusCode
2109 UA_DeleteSubscriptionsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteSubscriptionsResponse *dst) {
2111 }
2112 
2113 /* RelativePath */
2114 static UA_INLINE UA_StatusCode
2115 UA_RelativePath_encodeBinary(const UA_RelativePath *src, UA_ByteString *dst, size_t *offset) {
2116  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATH], NULL, NULL, dst, offset);
2117 }
2118 static UA_INLINE UA_StatusCode
2119 UA_RelativePath_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RelativePath *dst) {
2120  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATH]);
2121 }
2122 
2123 /* DeleteReferencesResponse */
2124 static UA_INLINE UA_StatusCode
2125 UA_DeleteReferencesResponse_encodeBinary(const UA_DeleteReferencesResponse *src, UA_ByteString *dst, size_t *offset) {
2126  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE], NULL, NULL, dst, offset);
2127 }
2128 static UA_INLINE UA_StatusCode
2129 UA_DeleteReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesResponse *dst) {
2130  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]);
2131 }
2132 
2133 /* CreateMonitoredItemsResponse */
2134 static UA_INLINE UA_StatusCode
2135 UA_CreateMonitoredItemsResponse_encodeBinary(const UA_CreateMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
2137 }
2138 static UA_INLINE UA_StatusCode
2139 UA_CreateMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateMonitoredItemsResponse *dst) {
2141 }
2142 
2143 /* CallResponse */
2144 static UA_INLINE UA_StatusCode
2145 UA_CallResponse_encodeBinary(const UA_CallResponse *src, UA_ByteString *dst, size_t *offset) {
2146  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLRESPONSE], NULL, NULL, dst, offset);
2147 }
2148 static UA_INLINE UA_StatusCode
2149 UA_CallResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallResponse *dst) {
2150  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLRESPONSE]);
2151 }
2152 
2153 /* DeleteNodesResponse */
2154 static UA_INLINE UA_StatusCode
2155 UA_DeleteNodesResponse_encodeBinary(const UA_DeleteNodesResponse *src, UA_ByteString *dst, size_t *offset) {
2156  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE], NULL, NULL, dst, offset);
2157 }
2158 static UA_INLINE UA_StatusCode
2159 UA_DeleteNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesResponse *dst) {
2160  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]);
2161 }
2162 
2163 /* RepublishResponse */
2164 static UA_INLINE UA_StatusCode
2165 UA_RepublishResponse_encodeBinary(const UA_RepublishResponse *src, UA_ByteString *dst, size_t *offset) {
2166  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE], NULL, NULL, dst, offset);
2167 }
2168 static UA_INLINE UA_StatusCode
2169 UA_RepublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RepublishResponse *dst) {
2170  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]);
2171 }
2172 
2173 /* MonitoredItemCreateRequest */
2174 static UA_INLINE UA_StatusCode
2175 UA_MonitoredItemCreateRequest_encodeBinary(const UA_MonitoredItemCreateRequest *src, UA_ByteString *dst, size_t *offset) {
2177 }
2178 static UA_INLINE UA_StatusCode
2179 UA_MonitoredItemCreateRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemCreateRequest *dst) {
2180  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST]);
2181 }
2182 
2183 /* DeleteReferencesRequest */
2184 static UA_INLINE UA_StatusCode
2185 UA_DeleteReferencesRequest_encodeBinary(const UA_DeleteReferencesRequest *src, UA_ByteString *dst, size_t *offset) {
2186  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST], NULL, NULL, dst, offset);
2187 }
2188 static UA_INLINE UA_StatusCode
2189 UA_DeleteReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesRequest *dst) {
2190  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]);
2191 }
2192 
2193 /* ModifyMonitoredItemsResponse */
2194 static UA_INLINE UA_StatusCode
2195 UA_ModifyMonitoredItemsResponse_encodeBinary(const UA_ModifyMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
2197 }
2198 static UA_INLINE UA_StatusCode
2199 UA_ModifyMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifyMonitoredItemsResponse *dst) {
2201 }
2202 
2203 /* ReadResponse */
2204 static UA_INLINE UA_StatusCode
2205 UA_ReadResponse_encodeBinary(const UA_ReadResponse *src, UA_ByteString *dst, size_t *offset) {
2206  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READRESPONSE], NULL, NULL, dst, offset);
2207 }
2208 static UA_INLINE UA_StatusCode
2209 UA_ReadResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadResponse *dst) {
2210  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READRESPONSE]);
2211 }
2212 
2213 /* AddReferencesRequest */
2214 static UA_INLINE UA_StatusCode
2215 UA_AddReferencesRequest_encodeBinary(const UA_AddReferencesRequest *src, UA_ByteString *dst, size_t *offset) {
2216  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST], NULL, NULL, dst, offset);
2217 }
2218 static UA_INLINE UA_StatusCode
2219 UA_AddReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesRequest *dst) {
2220  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]);
2221 }
2222 
2223 /* ReadRequest */
2224 static UA_INLINE UA_StatusCode
2225 UA_ReadRequest_encodeBinary(const UA_ReadRequest *src, UA_ByteString *dst, size_t *offset) {
2226  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READREQUEST], NULL, NULL, dst, offset);
2227 }
2228 static UA_INLINE UA_StatusCode
2229 UA_ReadRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadRequest *dst) {
2230  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READREQUEST]);
2231 }
2232 
2233 /* AddNodesItem */
2234 static UA_INLINE UA_StatusCode
2235 UA_AddNodesItem_encodeBinary(const UA_AddNodesItem *src, UA_ByteString *dst, size_t *offset) {
2236  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESITEM], NULL, NULL, dst, offset);
2237 }
2238 static UA_INLINE UA_StatusCode
2239 UA_AddNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesItem *dst) {
2240  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESITEM]);
2241 }
2242 
2243 /* ServerStatusDataType */
2244 static UA_INLINE UA_StatusCode
2245 UA_ServerStatusDataType_encodeBinary(const UA_ServerStatusDataType *src, UA_ByteString *dst, size_t *offset) {
2246  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE], NULL, NULL, dst, offset);
2247 }
2248 static UA_INLINE UA_StatusCode
2249 UA_ServerStatusDataType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServerStatusDataType *dst) {
2250  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]);
2251 }
2252 
2253 /* AddReferencesResponse */
2254 static UA_INLINE UA_StatusCode
2255 UA_AddReferencesResponse_encodeBinary(const UA_AddReferencesResponse *src, UA_ByteString *dst, size_t *offset) {
2256  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE], NULL, NULL, dst, offset);
2257 }
2258 static UA_INLINE UA_StatusCode
2259 UA_AddReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesResponse *dst) {
2260  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]);
2261 }
2262 
2263 /* TranslateBrowsePathsToNodeIdsResponse */
2264 static UA_INLINE UA_StatusCode
2265 UA_TranslateBrowsePathsToNodeIdsResponse_encodeBinary(const UA_TranslateBrowsePathsToNodeIdsResponse *src, UA_ByteString *dst, size_t *offset) {
2267 }
2268 static UA_INLINE UA_StatusCode
2269 UA_TranslateBrowsePathsToNodeIdsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsResponse *dst) {
2271 }
2272 
2273 /* DataChangeFilter */
2274 static UA_INLINE UA_StatusCode
2275 UA_DataChangeFilter_encodeBinary(const UA_DataChangeFilter *src, UA_ByteString *dst, size_t *offset) {
2276  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGEFILTER], NULL, NULL, dst, offset);
2277 }
2278 static UA_INLINE UA_StatusCode
2279 UA_DataChangeFilter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeFilter *dst) {
2280  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGEFILTER]);
2281 }
2282 
2283 /* ContentFilterElement */
2284 static UA_INLINE UA_StatusCode
2285 UA_ContentFilterElement_encodeBinary(const UA_ContentFilterElement *src, UA_ByteString *dst, size_t *offset) {
2286  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT], NULL, NULL, dst, offset);
2287 }
2288 static UA_INLINE UA_StatusCode
2289 UA_ContentFilterElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterElement *dst) {
2290  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT]);
2291 }
2292 
2293 /* CloseSessionResponse */
2294 static UA_INLINE UA_StatusCode
2295 UA_CloseSessionResponse_encodeBinary(const UA_CloseSessionResponse *src, UA_ByteString *dst, size_t *offset) {
2296  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE], NULL, NULL, dst, offset);
2297 }
2298 static UA_INLINE UA_StatusCode
2299 UA_CloseSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSessionResponse *dst) {
2300  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]);
2301 }
2302 
2303 /* ApplicationDescription */
2304 static UA_INLINE UA_StatusCode
2305 UA_ApplicationDescription_encodeBinary(const UA_ApplicationDescription *src, UA_ByteString *dst, size_t *offset) {
2306  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION], NULL, NULL, dst, offset);
2307 }
2308 static UA_INLINE UA_StatusCode
2309 UA_ApplicationDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ApplicationDescription *dst) {
2310  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]);
2311 }
2312 
2313 /* ServiceFault */
2314 static UA_INLINE UA_StatusCode
2315 UA_ServiceFault_encodeBinary(const UA_ServiceFault *src, UA_ByteString *dst, size_t *offset) {
2316  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVICEFAULT], NULL, NULL, dst, offset);
2317 }
2318 static UA_INLINE UA_StatusCode
2319 UA_ServiceFault_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServiceFault *dst) {
2320  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVICEFAULT]);
2321 }
2322 
2323 /* FindServersResponse */
2324 static UA_INLINE UA_StatusCode
2325 UA_FindServersResponse_encodeBinary(const UA_FindServersResponse *src, UA_ByteString *dst, size_t *offset) {
2326  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE], NULL, NULL, dst, offset);
2327 }
2328 static UA_INLINE UA_StatusCode
2329 UA_FindServersResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FindServersResponse *dst) {
2330  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]);
2331 }
2332 
2333 /* CreateMonitoredItemsRequest */
2334 static UA_INLINE UA_StatusCode
2335 UA_CreateMonitoredItemsRequest_encodeBinary(const UA_CreateMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
2337 }
2338 static UA_INLINE UA_StatusCode
2339 UA_CreateMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateMonitoredItemsRequest *dst) {
2341 }
2342 
2343 /* ContentFilter */
2344 static UA_INLINE UA_StatusCode
2345 UA_ContentFilter_encodeBinary(const UA_ContentFilter *src, UA_ByteString *dst, size_t *offset) {
2346  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTER], NULL, NULL, dst, offset);
2347 }
2348 static UA_INLINE UA_StatusCode
2349 UA_ContentFilter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilter *dst) {
2350  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTER]);
2351 }
2352 
2353 /* QueryFirstResponse */
2354 static UA_INLINE UA_StatusCode
2355 UA_QueryFirstResponse_encodeBinary(const UA_QueryFirstResponse *src, UA_ByteString *dst, size_t *offset) {
2356  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE], NULL, NULL, dst, offset);
2357 }
2358 static UA_INLINE UA_StatusCode
2359 UA_QueryFirstResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryFirstResponse *dst) {
2360  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]);
2361 }
2362 
2363 /* AddNodesRequest */
2364 static UA_INLINE UA_StatusCode
2365 UA_AddNodesRequest_encodeBinary(const UA_AddNodesRequest *src, UA_ByteString *dst, size_t *offset) {
2366  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESREQUEST], NULL, NULL, dst, offset);
2367 }
2368 static UA_INLINE UA_StatusCode
2369 UA_AddNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesRequest *dst) {
2370  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESREQUEST]);
2371 }
2372 
2373 /* BrowseRequest */
2374 static UA_INLINE UA_StatusCode
2375 UA_BrowseRequest_encodeBinary(const UA_BrowseRequest *src, UA_ByteString *dst, size_t *offset) {
2376  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEREQUEST], NULL, NULL, dst, offset);
2377 }
2378 static UA_INLINE UA_StatusCode
2379 UA_BrowseRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseRequest *dst) {
2380  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEREQUEST]);
2381 }
2382 
2383 /* BrowsePath */
2384 static UA_INLINE UA_StatusCode
2385 UA_BrowsePath_encodeBinary(const UA_BrowsePath *src, UA_ByteString *dst, size_t *offset) {
2386  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATH], NULL, NULL, dst, offset);
2387 }
2388 static UA_INLINE UA_StatusCode
2389 UA_BrowsePath_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePath *dst) {
2390  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATH]);
2391 }
2392 
2393 /* BrowseResult */
2394 static UA_INLINE UA_StatusCode
2395 UA_BrowseResult_encodeBinary(const UA_BrowseResult *src, UA_ByteString *dst, size_t *offset) {
2396  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULT], NULL, NULL, dst, offset);
2397 }
2398 static UA_INLINE UA_StatusCode
2399 UA_BrowseResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResult *dst) {
2400  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULT]);
2401 }
2402 
2403 /* CreateSessionRequest */
2404 static UA_INLINE UA_StatusCode
2405 UA_CreateSessionRequest_encodeBinary(const UA_CreateSessionRequest *src, UA_ByteString *dst, size_t *offset) {
2406  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST], NULL, NULL, dst, offset);
2407 }
2408 static UA_INLINE UA_StatusCode
2409 UA_CreateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSessionRequest *dst) {
2410  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]);
2411 }
2412 
2413 /* QueryDataDescription */
2414 static UA_INLINE UA_StatusCode
2415 UA_QueryDataDescription_encodeBinary(const UA_QueryDataDescription *src, UA_ByteString *dst, size_t *offset) {
2416  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION], NULL, NULL, dst, offset);
2417 }
2418 static UA_INLINE UA_StatusCode
2419 UA_QueryDataDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryDataDescription *dst) {
2420  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION]);
2421 }
2422 
2423 /* EndpointDescription */
2424 static UA_INLINE UA_StatusCode
2425 UA_EndpointDescription_encodeBinary(const UA_EndpointDescription *src, UA_ByteString *dst, size_t *offset) {
2426  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION], NULL, NULL, dst, offset);
2427 }
2428 static UA_INLINE UA_StatusCode
2429 UA_EndpointDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_EndpointDescription *dst) {
2430  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
2431 }
2432 
2433 /* GetEndpointsResponse */
2434 static UA_INLINE UA_StatusCode
2435 UA_GetEndpointsResponse_encodeBinary(const UA_GetEndpointsResponse *src, UA_ByteString *dst, size_t *offset) {
2436  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE], NULL, NULL, dst, offset);
2437 }
2438 static UA_INLINE UA_StatusCode
2439 UA_GetEndpointsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_GetEndpointsResponse *dst) {
2440  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]);
2441 }
2442 
2443 /* NodeTypeDescription */
2444 static UA_INLINE UA_StatusCode
2445 UA_NodeTypeDescription_encodeBinary(const UA_NodeTypeDescription *src, UA_ByteString *dst, size_t *offset) {
2446  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION], NULL, NULL, dst, offset);
2447 }
2448 static UA_INLINE UA_StatusCode
2449 UA_NodeTypeDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeTypeDescription *dst) {
2450  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION]);
2451 }
2452 
2453 /* BrowseNextResponse */
2454 static UA_INLINE UA_StatusCode
2455 UA_BrowseNextResponse_encodeBinary(const UA_BrowseNextResponse *src, UA_ByteString *dst, size_t *offset) {
2456  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE], NULL, NULL, dst, offset);
2457 }
2458 static UA_INLINE UA_StatusCode
2459 UA_BrowseNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseNextResponse *dst) {
2460  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]);
2461 }
2462 
2463 /* TranslateBrowsePathsToNodeIdsRequest */
2464 static UA_INLINE UA_StatusCode
2465 UA_TranslateBrowsePathsToNodeIdsRequest_encodeBinary(const UA_TranslateBrowsePathsToNodeIdsRequest *src, UA_ByteString *dst, size_t *offset) {
2467 }
2468 static UA_INLINE UA_StatusCode
2469 UA_TranslateBrowsePathsToNodeIdsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsRequest *dst) {
2471 }
2472 
2473 /* BrowseResponse */
2474 static UA_INLINE UA_StatusCode
2475 UA_BrowseResponse_encodeBinary(const UA_BrowseResponse *src, UA_ByteString *dst, size_t *offset) {
2476  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESPONSE], NULL, NULL, dst, offset);
2477 }
2478 static UA_INLINE UA_StatusCode
2479 UA_BrowseResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResponse *dst) {
2480  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESPONSE]);
2481 }
2482 
2483 /* CreateSessionResponse */
2484 static UA_INLINE UA_StatusCode
2485 UA_CreateSessionResponse_encodeBinary(const UA_CreateSessionResponse *src, UA_ByteString *dst, size_t *offset) {
2486  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE], NULL, NULL, dst, offset);
2487 }
2488 static UA_INLINE UA_StatusCode
2489 UA_CreateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSessionResponse *dst) {
2490  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]);
2491 }
2492 
2493 /* QueryFirstRequest */
2494 static UA_INLINE UA_StatusCode
2495 UA_QueryFirstRequest_encodeBinary(const UA_QueryFirstRequest *src, UA_ByteString *dst, size_t *offset) {
2496  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST], NULL, NULL, dst, offset);
2497 }
2498 static UA_INLINE UA_StatusCode
2499 UA_QueryFirstRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryFirstRequest *dst) {
2500  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST]);
2501 }
2502 
2503 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated.h" ***********************************/
2504 
2505 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
2506  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
2507 
2508 
2509 #ifdef __cplusplus
2510 extern "C" {
2511 #endif
2512 
2513 
2518 #define UA_TRANSPORT_COUNT 12
2520 
2525 typedef struct {
2529 
2530 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY 0
2531 
2536 typedef struct {
2537  size_t paddingSize;
2541 
2542 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER 1
2543 
2548 typedef struct {
2556 
2557 #define UA_TRANSPORT_TCPHELLOMESSAGE 2
2558 
2563 typedef struct {
2567 
2568 #define UA_TRANSPORT_TCPERRORMESSAGE 3
2569 
2574 typedef enum {
2582 } UA_MessageType;
2583 UA_STATIC_ASSERT(sizeof(UA_MessageType) == sizeof(UA_Int32), enum_must_be_32bit);
2584 
2585 #define UA_TRANSPORT_MESSAGETYPE 4
2586 
2591 typedef struct {
2596 
2597 #define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER 5
2598 
2603 typedef struct {
2610 
2611 #define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE 6
2612 
2617 typedef struct {
2621 
2622 #define UA_TRANSPORT_SEQUENCEHEADER 7
2623 
2628 typedef struct {
2632 
2633 #define UA_TRANSPORT_TCPMESSAGEHEADER 8
2634 
2639 typedef enum {
2640  UA_CHUNKTYPE_FINAL = 0x46000000,
2642  UA_CHUNKTYPE_ABORT = 0x41000000,
2644 } UA_ChunkType;
2645 UA_STATIC_ASSERT(sizeof(UA_ChunkType) == sizeof(UA_Int32), enum_must_be_32bit);
2646 
2647 #define UA_TRANSPORT_CHUNKTYPE 9
2648 
2653 typedef struct {
2656 
2657 #define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER 10
2658 
2663 typedef struct {
2667 
2668 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER 11
2669 
2670 #ifdef __cplusplus
2671 } // extern "C"
2672 #endif
2673 
2674 
2675 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated_handling.h" ***********************************/
2676 
2677 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
2678  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
2679 
2680 
2681 #ifdef __cplusplus
2682 extern "C" {
2683 #endif
2684 
2685 
2686 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
2687 # pragma GCC diagnostic push
2688 # pragma GCC diagnostic ignored "-Wmissing-field-initializers"
2689 # pragma GCC diagnostic ignored "-Wmissing-braces"
2690 #endif
2691 
2692 
2693 /* SecureConversationMessageAbortBody */
2694 static UA_INLINE void
2695 UA_SecureConversationMessageAbortBody_init(UA_SecureConversationMessageAbortBody *p) {
2696  memset(p, 0, sizeof(UA_SecureConversationMessageAbortBody));
2697 }
2698 
2700 UA_SecureConversationMessageAbortBody_new(void) {
2702 }
2703 
2704 static UA_INLINE UA_StatusCode
2705 UA_SecureConversationMessageAbortBody_copy(const UA_SecureConversationMessageAbortBody *src, UA_SecureConversationMessageAbortBody *dst) {
2706  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]);
2707 }
2708 
2709 static UA_INLINE void
2710 UA_SecureConversationMessageAbortBody_deleteMembers(UA_SecureConversationMessageAbortBody *p) {
2712 }
2713 
2714 static UA_INLINE void
2715 UA_SecureConversationMessageAbortBody_delete(UA_SecureConversationMessageAbortBody *p) {
2717 }
2718 
2719 /* SecureConversationMessageFooter */
2720 static UA_INLINE void
2721 UA_SecureConversationMessageFooter_init(UA_SecureConversationMessageFooter *p) {
2722  memset(p, 0, sizeof(UA_SecureConversationMessageFooter));
2723 }
2724 
2726 UA_SecureConversationMessageFooter_new(void) {
2728 }
2729 
2730 static UA_INLINE UA_StatusCode
2731 UA_SecureConversationMessageFooter_copy(const UA_SecureConversationMessageFooter *src, UA_SecureConversationMessageFooter *dst) {
2732  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]);
2733 }
2734 
2735 static UA_INLINE void
2736 UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter *p) {
2738 }
2739 
2740 static UA_INLINE void
2741 UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageFooter *p) {
2743 }
2744 
2745 /* TcpHelloMessage */
2746 static UA_INLINE void
2747 UA_TcpHelloMessage_init(UA_TcpHelloMessage *p) {
2748  memset(p, 0, sizeof(UA_TcpHelloMessage));
2749 }
2750 
2752 UA_TcpHelloMessage_new(void) {
2753  return (UA_TcpHelloMessage*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2754 }
2755 
2756 static UA_INLINE UA_StatusCode
2757 UA_TcpHelloMessage_copy(const UA_TcpHelloMessage *src, UA_TcpHelloMessage *dst) {
2758  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2759 }
2760 
2761 static UA_INLINE void
2762 UA_TcpHelloMessage_deleteMembers(UA_TcpHelloMessage *p) {
2764 }
2765 
2766 static UA_INLINE void
2767 UA_TcpHelloMessage_delete(UA_TcpHelloMessage *p) {
2768  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2769 }
2770 
2771 /* TcpErrorMessage */
2772 static UA_INLINE void
2773 UA_TcpErrorMessage_init(UA_TcpErrorMessage *p) {
2774  memset(p, 0, sizeof(UA_TcpErrorMessage));
2775 }
2776 
2778 UA_TcpErrorMessage_new(void) {
2779  return (UA_TcpErrorMessage*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2780 }
2781 
2782 static UA_INLINE UA_StatusCode
2783 UA_TcpErrorMessage_copy(const UA_TcpErrorMessage *src, UA_TcpErrorMessage *dst) {
2784  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2785 }
2786 
2787 static UA_INLINE void
2788 UA_TcpErrorMessage_deleteMembers(UA_TcpErrorMessage *p) {
2790 }
2791 
2792 static UA_INLINE void
2793 UA_TcpErrorMessage_delete(UA_TcpErrorMessage *p) {
2794  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2795 }
2796 
2797 /* MessageType */
2798 static UA_INLINE void
2799 UA_MessageType_init(UA_MessageType *p) {
2800  memset(p, 0, sizeof(UA_MessageType));
2801 }
2802 
2803 static UA_INLINE UA_MessageType *
2804 UA_MessageType_new(void) {
2805  return (UA_MessageType*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
2806 }
2807 
2808 static UA_INLINE UA_StatusCode
2809 UA_MessageType_copy(const UA_MessageType *src, UA_MessageType *dst) {
2810  *dst = *src;
2811  return UA_STATUSCODE_GOOD;
2812 }
2813 
2814 static UA_INLINE void
2815 UA_MessageType_deleteMembers(UA_MessageType *p) { }
2816 
2817 static UA_INLINE void
2818 UA_MessageType_delete(UA_MessageType *p) {
2819  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
2820 }
2821 
2822 /* AsymmetricAlgorithmSecurityHeader */
2823 static UA_INLINE void
2824 UA_AsymmetricAlgorithmSecurityHeader_init(UA_AsymmetricAlgorithmSecurityHeader *p) {
2825  memset(p, 0, sizeof(UA_AsymmetricAlgorithmSecurityHeader));
2826 }
2827 
2829 UA_AsymmetricAlgorithmSecurityHeader_new(void) {
2831 }
2832 
2833 static UA_INLINE UA_StatusCode
2834 UA_AsymmetricAlgorithmSecurityHeader_copy(const UA_AsymmetricAlgorithmSecurityHeader *src, UA_AsymmetricAlgorithmSecurityHeader *dst) {
2835  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]);
2836 }
2837 
2838 static UA_INLINE void
2839 UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(UA_AsymmetricAlgorithmSecurityHeader *p) {
2841 }
2842 
2843 static UA_INLINE void
2844 UA_AsymmetricAlgorithmSecurityHeader_delete(UA_AsymmetricAlgorithmSecurityHeader *p) {
2846 }
2847 
2848 /* TcpAcknowledgeMessage */
2849 static UA_INLINE void
2850 UA_TcpAcknowledgeMessage_init(UA_TcpAcknowledgeMessage *p) {
2851  memset(p, 0, sizeof(UA_TcpAcknowledgeMessage));
2852 }
2853 
2855 UA_TcpAcknowledgeMessage_new(void) {
2857 }
2858 
2859 static UA_INLINE UA_StatusCode
2860 UA_TcpAcknowledgeMessage_copy(const UA_TcpAcknowledgeMessage *src, UA_TcpAcknowledgeMessage *dst) {
2861  *dst = *src;
2862  return UA_STATUSCODE_GOOD;
2863 }
2864 
2865 static UA_INLINE void
2866 UA_TcpAcknowledgeMessage_deleteMembers(UA_TcpAcknowledgeMessage *p) { }
2867 
2868 static UA_INLINE void
2869 UA_TcpAcknowledgeMessage_delete(UA_TcpAcknowledgeMessage *p) {
2870  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]);
2871 }
2872 
2873 /* SequenceHeader */
2874 static UA_INLINE void
2875 UA_SequenceHeader_init(UA_SequenceHeader *p) {
2876  memset(p, 0, sizeof(UA_SequenceHeader));
2877 }
2878 
2880 UA_SequenceHeader_new(void) {
2881  return (UA_SequenceHeader*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
2882 }
2883 
2884 static UA_INLINE UA_StatusCode
2885 UA_SequenceHeader_copy(const UA_SequenceHeader *src, UA_SequenceHeader *dst) {
2886  *dst = *src;
2887  return UA_STATUSCODE_GOOD;
2888 }
2889 
2890 static UA_INLINE void
2891 UA_SequenceHeader_deleteMembers(UA_SequenceHeader *p) { }
2892 
2893 static UA_INLINE void
2894 UA_SequenceHeader_delete(UA_SequenceHeader *p) {
2895  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
2896 }
2897 
2898 /* TcpMessageHeader */
2899 static UA_INLINE void
2900 UA_TcpMessageHeader_init(UA_TcpMessageHeader *p) {
2901  memset(p, 0, sizeof(UA_TcpMessageHeader));
2902 }
2903 
2905 UA_TcpMessageHeader_new(void) {
2906  return (UA_TcpMessageHeader*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
2907 }
2908 
2909 static UA_INLINE UA_StatusCode
2910 UA_TcpMessageHeader_copy(const UA_TcpMessageHeader *src, UA_TcpMessageHeader *dst) {
2911  *dst = *src;
2912  return UA_STATUSCODE_GOOD;
2913 }
2914 
2915 static UA_INLINE void
2916 UA_TcpMessageHeader_deleteMembers(UA_TcpMessageHeader *p) { }
2917 
2918 static UA_INLINE void
2919 UA_TcpMessageHeader_delete(UA_TcpMessageHeader *p) {
2920  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
2921 }
2922 
2923 /* ChunkType */
2924 static UA_INLINE void
2925 UA_ChunkType_init(UA_ChunkType *p) {
2926  memset(p, 0, sizeof(UA_ChunkType));
2927 }
2928 
2929 static UA_INLINE UA_ChunkType *
2930 UA_ChunkType_new(void) {
2931  return (UA_ChunkType*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
2932 }
2933 
2934 static UA_INLINE UA_StatusCode
2935 UA_ChunkType_copy(const UA_ChunkType *src, UA_ChunkType *dst) {
2936  *dst = *src;
2937  return UA_STATUSCODE_GOOD;
2938 }
2939 
2940 static UA_INLINE void
2941 UA_ChunkType_deleteMembers(UA_ChunkType *p) { }
2942 
2943 static UA_INLINE void
2944 UA_ChunkType_delete(UA_ChunkType *p) {
2945  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
2946 }
2947 
2948 /* SymmetricAlgorithmSecurityHeader */
2949 static UA_INLINE void
2950 UA_SymmetricAlgorithmSecurityHeader_init(UA_SymmetricAlgorithmSecurityHeader *p) {
2951  memset(p, 0, sizeof(UA_SymmetricAlgorithmSecurityHeader));
2952 }
2953 
2955 UA_SymmetricAlgorithmSecurityHeader_new(void) {
2957 }
2958 
2959 static UA_INLINE UA_StatusCode
2960 UA_SymmetricAlgorithmSecurityHeader_copy(const UA_SymmetricAlgorithmSecurityHeader *src, UA_SymmetricAlgorithmSecurityHeader *dst) {
2961  *dst = *src;
2962  return UA_STATUSCODE_GOOD;
2963 }
2964 
2965 static UA_INLINE void
2966 UA_SymmetricAlgorithmSecurityHeader_deleteMembers(UA_SymmetricAlgorithmSecurityHeader *p) { }
2967 
2968 static UA_INLINE void
2969 UA_SymmetricAlgorithmSecurityHeader_delete(UA_SymmetricAlgorithmSecurityHeader *p) {
2971 }
2972 
2973 /* SecureConversationMessageHeader */
2974 static UA_INLINE void
2975 UA_SecureConversationMessageHeader_init(UA_SecureConversationMessageHeader *p) {
2976  memset(p, 0, sizeof(UA_SecureConversationMessageHeader));
2977 }
2978 
2980 UA_SecureConversationMessageHeader_new(void) {
2982 }
2983 
2984 static UA_INLINE UA_StatusCode
2985 UA_SecureConversationMessageHeader_copy(const UA_SecureConversationMessageHeader *src, UA_SecureConversationMessageHeader *dst) {
2986  *dst = *src;
2987  return UA_STATUSCODE_GOOD;
2988 }
2989 
2990 static UA_INLINE void
2991 UA_SecureConversationMessageHeader_deleteMembers(UA_SecureConversationMessageHeader *p) { }
2992 
2993 static UA_INLINE void
2994 UA_SecureConversationMessageHeader_delete(UA_SecureConversationMessageHeader *p) {
2996 }
2997 
2998 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
2999 # pragma GCC diagnostic pop
3000 #endif
3001 
3002 #ifdef __cplusplus
3003 } // extern "C"
3004 #endif
3005 
3006 
3007 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated_encoding_binary.h" ***********************************/
3008 
3009 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
3010  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
3011 
3012 
3013 /* SecureConversationMessageAbortBody */
3014 static UA_INLINE UA_StatusCode
3015 UA_SecureConversationMessageAbortBody_encodeBinary(const UA_SecureConversationMessageAbortBody *src, UA_ByteString *dst, size_t *offset) {
3016  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY], NULL, NULL, dst, offset);
3017 }
3018 static UA_INLINE UA_StatusCode
3019 UA_SecureConversationMessageAbortBody_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageAbortBody *dst) {
3020  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]);
3021 }
3022 
3023 /* SecureConversationMessageFooter */
3024 static UA_INLINE UA_StatusCode
3025 UA_SecureConversationMessageFooter_encodeBinary(const UA_SecureConversationMessageFooter *src, UA_ByteString *dst, size_t *offset) {
3026  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER], NULL, NULL, dst, offset);
3027 }
3028 static UA_INLINE UA_StatusCode
3029 UA_SecureConversationMessageFooter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageFooter *dst) {
3030  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]);
3031 }
3032 
3033 /* TcpHelloMessage */
3034 static UA_INLINE UA_StatusCode
3035 UA_TcpHelloMessage_encodeBinary(const UA_TcpHelloMessage *src, UA_ByteString *dst, size_t *offset) {
3036  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE], NULL, NULL, dst, offset);
3037 }
3038 static UA_INLINE UA_StatusCode
3039 UA_TcpHelloMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpHelloMessage *dst) {
3040  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
3041 }
3042 
3043 /* TcpErrorMessage */
3044 static UA_INLINE UA_StatusCode
3045 UA_TcpErrorMessage_encodeBinary(const UA_TcpErrorMessage *src, UA_ByteString *dst, size_t *offset) {
3046  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE], NULL, NULL, dst, offset);
3047 }
3048 static UA_INLINE UA_StatusCode
3049 UA_TcpErrorMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpErrorMessage *dst) {
3050  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
3051 }
3052 
3053 /* MessageType */
3054 static UA_INLINE UA_StatusCode
3055 UA_MessageType_encodeBinary(const UA_MessageType *src, UA_ByteString *dst, size_t *offset) {
3056  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE], NULL, NULL, dst, offset);
3057 }
3058 static UA_INLINE UA_StatusCode
3059 UA_MessageType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MessageType *dst) {
3060  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
3061 }
3062 
3063 /* AsymmetricAlgorithmSecurityHeader */
3064 static UA_INLINE UA_StatusCode
3065 UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(const UA_AsymmetricAlgorithmSecurityHeader *src, UA_ByteString *dst, size_t *offset) {
3066  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER], NULL, NULL, dst, offset);
3067 }
3068 static UA_INLINE UA_StatusCode
3069 UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AsymmetricAlgorithmSecurityHeader *dst) {
3070  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]);
3071 }
3072 
3073 /* TcpAcknowledgeMessage */
3074 static UA_INLINE UA_StatusCode
3075 UA_TcpAcknowledgeMessage_encodeBinary(const UA_TcpAcknowledgeMessage *src, UA_ByteString *dst, size_t *offset) {
3076  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE], NULL, NULL, dst, offset);
3077 }
3078 static UA_INLINE UA_StatusCode
3079 UA_TcpAcknowledgeMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpAcknowledgeMessage *dst) {
3080  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]);
3081 }
3082 
3083 /* SequenceHeader */
3084 static UA_INLINE UA_StatusCode
3085 UA_SequenceHeader_encodeBinary(const UA_SequenceHeader *src, UA_ByteString *dst, size_t *offset) {
3086  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER], NULL, NULL, dst, offset);
3087 }
3088 static UA_INLINE UA_StatusCode
3089 UA_SequenceHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SequenceHeader *dst) {
3090  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
3091 }
3092 
3093 /* TcpMessageHeader */
3094 static UA_INLINE UA_StatusCode
3095 UA_TcpMessageHeader_encodeBinary(const UA_TcpMessageHeader *src, UA_ByteString *dst, size_t *offset) {
3096  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER], NULL, NULL, dst, offset);
3097 }
3098 static UA_INLINE UA_StatusCode
3099 UA_TcpMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpMessageHeader *dst) {
3100  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
3101 }
3102 
3103 /* ChunkType */
3104 static UA_INLINE UA_StatusCode
3105 UA_ChunkType_encodeBinary(const UA_ChunkType *src, UA_ByteString *dst, size_t *offset) {
3106  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE], NULL, NULL, dst, offset);
3107 }
3108 static UA_INLINE UA_StatusCode
3109 UA_ChunkType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChunkType *dst) {
3110  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
3111 }
3112 
3113 /* SymmetricAlgorithmSecurityHeader */
3114 static UA_INLINE UA_StatusCode
3115 UA_SymmetricAlgorithmSecurityHeader_encodeBinary(const UA_SymmetricAlgorithmSecurityHeader *src, UA_ByteString *dst, size_t *offset) {
3116  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER], NULL, NULL, dst, offset);
3117 }
3118 static UA_INLINE UA_StatusCode
3119 UA_SymmetricAlgorithmSecurityHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SymmetricAlgorithmSecurityHeader *dst) {
3120  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER]);
3121 }
3122 
3123 /* SecureConversationMessageHeader */
3124 static UA_INLINE UA_StatusCode
3125 UA_SecureConversationMessageHeader_encodeBinary(const UA_SecureConversationMessageHeader *src, UA_ByteString *dst, size_t *offset) {
3126  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER], NULL, NULL, dst, offset);
3127 }
3128 static UA_INLINE UA_StatusCode
3129 UA_SecureConversationMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageHeader *dst) {
3130  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER]);
3131 }
3132 
3133 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_connection_internal.h" ***********************************/
3134 
3135 /* This Source Code Form is subject to the terms of the Mozilla Public
3136 * License, v. 2.0. If a copy of the MPL was not distributed with this
3137 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3138 
3139 
3140 
3141 /* The network layer may receive chopped up messages since TCP is a streaming
3142  * protocol. Furthermore, the networklayer may operate on ringbuffers or
3143  * statically assigned memory.
3144  *
3145  * If an entire message is received, it is forwarded directly. But the memory
3146  * needs to be freed with the networklayer-specific mechanism. If a half message
3147  * is received, we copy it into a local buffer. Then, the stack-specific free
3148  * needs to be used.
3149  *
3150  * @param connection The connection
3151  * @param message The received message. The content may be overwritten when a
3152  * previsouly received buffer is completed.
3153  * @param realloced The Boolean value is set to true if the outgoing message has
3154  * been reallocated from the network layer.
3155  * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs, the ingoing message
3156  * and the current buffer in the connection are freed. */
3159  UA_Boolean *realloced);
3160 
3161 /* Try to receive at least one complete chunk on the connection. This blocks the
3162  * current thread up to the given timeout.
3163  *
3164  * @param connection The connection
3165  * @param chunk The received chunk. The memory is allocated either by the
3166  * networklayer or internally.
3167  * @param realloced The Boolean value is set to true if the chunk has been
3168  * reallocated from the network layer.
3169  * @param timeout The timeout (in milliseconds) the method will block at most.
3170  * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs,
3171  * the chunk buffer is returned empty. Upon a timeout,
3172  * UA_STATUSCODE_GOODNONCRITICALTIMEOUT is returned.
3173  */
3176  UA_Boolean *realloced, UA_UInt32 timeout);
3177 
3180 
3181 /* Split the given endpoint url into hostname and port. Some of the chunks are
3182  * returned as pointer.
3183  * @param endpointUrl The endpoint URL to split up
3184  * @param hostname the target array for hostname. Has to be at least 256 size.
3185  * @param port if url contains port, it will point to the beginning of port.
3186  * NULL otherwise. It may also include the path part, thus stop at
3187  * position of path pointer, if it is not NULL.
3188  * @param path points to the first occurance of '/' after the port or NULL if no
3189  * path in url
3190  * @return UA_STATUSCODE_BADOUTOFRANGE if url too long,
3191  * UA_STATUSCODE_BADATTRIBUTEIDINVALID if url not starting with
3192  * 'opc.tcp://', UA_STATUSCODE_GOOD on success */
3194 UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
3195  const char ** port, const char ** path);
3196 
3197 
3198 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_securechannel.h" ***********************************/
3199 
3200 /* This Source Code Form is subject to the terms of the Mozilla Public
3201 * License, v. 2.0. If a copy of the MPL was not distributed with this
3202 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3203 
3204 
3205 
3206 struct UA_Session;
3207 typedef struct UA_Session UA_Session;
3208 
3210  LIST_ENTRY(SessionEntry) pointers;
3211  UA_Session *session; // Just a pointer. The session is held in the session manager or the client
3212 };
3213 
3214 /* For chunked requests */
3215 struct ChunkEntry {
3216  LIST_ENTRY(ChunkEntry) pointers;
3217  UA_UInt32 requestId;
3218  UA_ByteString bytes;
3219 };
3220 
3221 /* For chunked responses */
3222 typedef struct {
3228  UA_Boolean final;
3230 } UA_ChunkInfo;
3231 
3234  UA_ChannelSecurityToken securityToken; // the channelId is contained in the securityToken
3235  UA_ChannelSecurityToken nextSecurityToken; // the channelId is contained in the securityToken
3243  LIST_HEAD(session_pointerlist, SessionEntry) sessions;
3244  LIST_HEAD(chunk_pointerlist, ChunkEntry) chunks;
3245 };
3246 
3249 
3251 
3255 
3257  const void *content, const UA_DataType *contentType);
3258 
3260 
3264 typedef void
3265 (UA_ProcessMessageCallback)(void *application, UA_SecureChannel *channel,
3266  UA_MessageType messageType, UA_UInt32 requestId,
3267  const UA_ByteString *message);
3268 
3271  UA_ProcessMessageCallback callback, void *application);
3272 
3276 #define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3277  UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3278  ((CHANNEL)->connection ? CHANNEL->connection->sockfd : 0), \
3279  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3280 
3281 #define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3282  UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3283  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3284  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3285 
3286 #define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3287  UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3288  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3289  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3290 
3291 #define UA_LOG_WARNING_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3292  UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3293  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3294  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3295 
3296 #define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3297  UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3298  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3299  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3300 
3301 #define UA_LOG_FATAL_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3302  UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3303  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3304  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3305 
3306 
3307 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodes.h" ***********************************/
3308 
3309 /* This Source Code Form is subject to the terms of the Mozilla Public
3310 * License, v. 2.0. If a copy of the MPL was not distributed with this
3311 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3312 
3313 
3314 #ifdef __cplusplus
3315 extern "C" {
3316 #endif
3317 
3318 
3356 #define UA_NODE_BASEATTRIBUTES \
3357  UA_NodeId nodeId; \
3358  UA_NodeClass nodeClass; \
3359  UA_QualifiedName browseName; \
3360  UA_LocalizedText displayName; \
3361  UA_LocalizedText description; \
3362  UA_UInt32 writeMask; \
3363  UA_UInt32 userWriteMask; \
3364  size_t referencesSize; \
3365  UA_ReferenceNode *references;
3366 
3367 typedef struct {
3369 } UA_Node;
3370 
3436 /* Indicates whether a variable contains data inline or whether it points to an
3437  * external data source */
3438 typedef enum {
3441 } UA_ValueSource;
3442 
3443 #define UA_NODE_VARIABLEATTRIBUTES \
3444  /* Constraints on possible values */ \
3445  UA_NodeId dataType; \
3446  UA_Int32 valueRank; \
3447  size_t arrayDimensionsSize; \
3448  UA_UInt32 *arrayDimensions; \
3449  \
3450  /* The current value */ \
3451  UA_ValueSource valueSource; \
3452  union { \
3453  struct { \
3454  UA_DataValue value; \
3455  UA_ValueCallback callback; \
3456  } data; \
3457  UA_DataSource dataSource; \
3458  } value;
3459 
3460 typedef struct {
3466  UA_Boolean historizing; /* currently unsupported */
3467 } UA_VariableNode;
3468 
3481 typedef struct {
3486 
3505 typedef struct {
3509 
3510  /* Members specific to open62541 */
3512  UA_MethodCallback attachedMethod;
3513 } UA_MethodNode;
3514 
3523 typedef struct {
3526 
3527  /* Members specific to open62541 */
3529 } UA_ObjectNode;
3530 
3540 typedef struct {
3543 
3544  /* Members specific to open62541 */
3545  UA_ObjectLifecycleManagement lifecycleManagement;
3547 
3650 typedef struct {
3656 
3671 typedef struct {
3674 } UA_DataTypeNode;
3675 
3685 typedef struct {
3689 } UA_ViewNode;
3690 
3691 #ifdef __cplusplus
3692 } // extern "C"
3693 #endif
3694 
3695 
3696 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_session.h" ***********************************/
3697 
3698 /* This Source Code Form is subject to the terms of the Mozilla Public
3699 * License, v. 2.0. If a copy of the MPL was not distributed with this
3700 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3701 
3702 
3703 
3704 #define UA_MAXCONTINUATIONPOINTS 5
3705 
3708  UA_ByteString identifier;
3709  UA_BrowseDescription browseDescription;
3710  UA_UInt32 continuationIndex;
3711  UA_UInt32 maxReferences;
3712 };
3713 
3714 struct UA_Subscription;
3716 
3717 #ifdef UA_ENABLE_SUBSCRIPTIONS
3718 typedef struct UA_PublishResponseEntry {
3719  SIMPLEQ_ENTRY(UA_PublishResponseEntry) listEntry;
3720  UA_UInt32 requestId;
3721  UA_PublishResponse response;
3722 } UA_PublishResponseEntry;
3723 #endif
3724 
3725 struct UA_Session {
3737  LIST_HEAD(ContinuationPointList, ContinuationPointEntry) continuationPoints;
3738 #ifdef UA_ENABLE_SUBSCRIPTIONS
3739  UA_UInt32 lastSubscriptionID;
3740  LIST_HEAD(UA_ListOfUASubscriptions, UA_Subscription) serverSubscriptions;
3741  SIMPLEQ_HEAD(UA_ListOfQueuedPublishResponses, UA_PublishResponseEntry) responseQueue;
3742 #endif
3743 };
3744 
3745 /* Local access to the services (for startup and maintenance) uses this Session
3746  * with all possible access rights (Session ID: 1) */
3747 extern UA_Session adminSession;
3748 
3749 void UA_Session_init(UA_Session *session);
3750 void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server);
3751 
3752 /* If any activity on a session happens, the timeout is extended */
3753 void UA_Session_updateLifetime(UA_Session *session);
3754 
3755 #ifdef UA_ENABLE_SUBSCRIPTIONS
3756 void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription);
3757 
3759 UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID);
3760 
3762 UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
3763  UA_UInt32 subscriptionID);
3764 
3765 UA_UInt32
3766 UA_Session_getUniqueSubscriptionID(UA_Session *session);
3767 #endif
3768 
3773 #define UA_LOG_TRACE_SESSION(LOGGER, SESSION, MSG, ...) \
3774  UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3775  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3776  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3777  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3778  ##__VA_ARGS__);
3779 
3780 #define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG, ...) \
3781  UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3782  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3783  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3784  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3785  ##__VA_ARGS__);
3786 
3787 #define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG, ...) \
3788  UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3789  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3790  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3791  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3792  ##__VA_ARGS__);
3793 
3794 #define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG, ...) \
3795  UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3796  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3797  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3798  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3799  ##__VA_ARGS__);
3800 
3801 #define UA_LOG_ERROR_SESSION(LOGGER, SESSION, MSG, ...) \
3802  UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3803  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3804  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3805  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3806  ##__VA_ARGS__);
3807 
3808 #define UA_LOG_FATAL_SESSION(LOGGER, SESSION, MSG, ...) \
3809  UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3810  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3811  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3812  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3813  ##__VA_ARGS__);
3814 
3815 
3816 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_subscription.h" ***********************************/
3817 
3818 /* This Source Code Form is subject to the terms of the Mozilla Public
3819 * License, v. 2.0. If a copy of the MPL was not distributed with this
3820 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3821 
3822 
3823 
3824 /*****************/
3825 /* MonitoredItem */
3826 /*****************/
3827 
3828 typedef enum {
3833 
3836  UA_UInt32 clientHandle;
3837  UA_DataValue value;
3839 
3840 typedef struct UA_MonitoredItem {
3841  LIST_ENTRY(UA_MonitoredItem) listEntry;
3842 
3843  /* Settings */
3844  UA_Subscription *subscription;
3845  UA_UInt32 itemId;
3846  UA_MonitoredItemType monitoredItemType;
3847  UA_TimestampsToReturn timestampsToReturn;
3848  UA_MonitoringMode monitoringMode;
3849  UA_NodeId monitoredNodeId;
3850  UA_UInt32 attributeID;
3851  UA_UInt32 clientHandle;
3852  UA_Double samplingInterval; // [ms]
3853  UA_UInt32 currentQueueSize;
3854  UA_UInt32 maxQueueSize;
3855  UA_Boolean discardOldest;
3856  UA_String indexRange;
3857  // TODO: dataEncoding is hardcoded to UA binary
3858  UA_DataChangeTrigger trigger;
3859 
3860  /* Sample Job */
3861  UA_Guid sampleJobGuid;
3862  UA_Boolean sampleJobIsRegistered;
3863 
3864  /* Sample Queue */
3865  UA_ByteString lastSampledValue;
3866  TAILQ_HEAD(QueueOfQueueDataValues, MonitoredItem_queuedValue) queue;
3868 
3870 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem);
3871 void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem);
3874 
3875 /****************/
3876 /* Subscription */
3877 /****************/
3878 
3881  UA_NotificationMessage message;
3883 
3884 /* We use only a subset of the states defined in the standard */
3885 typedef enum {
3886  /* UA_SUBSCRIPTIONSTATE_CLOSED */
3887  /* UA_SUBSCRIPTIONSTATE_CREATING */
3892 
3894  LIST_ENTRY(UA_Subscription) listEntry;
3895 
3896  /* Settings */
3897  UA_Session *session;
3898  UA_UInt32 lifeTimeCount;
3899  UA_UInt32 maxKeepAliveCount;
3900  UA_Double publishingInterval; /* in ms */
3901  UA_UInt32 subscriptionID;
3902  UA_UInt32 notificationsPerPublish;
3903  UA_Boolean publishingEnabled;
3904  UA_UInt32 priority;
3905 
3906  /* Runtime information */
3907  UA_SubscriptionState state;
3908  UA_UInt32 sequenceNumber;
3909  UA_UInt32 currentKeepAliveCount;
3910  UA_UInt32 currentLifetimeCount;
3911  UA_UInt32 lastMonitoredItemId;
3912 
3913  /* Publish Job */
3914  UA_Guid publishJobGuid;
3915  UA_Boolean publishJobIsRegistered;
3916 
3917  /* MonitoredItems */
3918  LIST_HEAD(UA_ListOfUAMonitoredItems, UA_MonitoredItem) monitoredItems;
3919 
3920  /* Retransmission Queue */
3921  TAILQ_HEAD(UA_ListOfNotificationMessages, UA_NotificationMessageEntry) retransmissionQueue;
3922  UA_UInt32 retransmissionQueueSize;
3923 };
3924 
3925 UA_Subscription *UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID);
3926 void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server);
3929 
3932  UA_UInt32 monitoredItemID);
3933 
3936 
3938 
3941 
3942 void
3944  UA_NodeId *sessionToken);
3945 
3946 
3947 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore.h" ***********************************/
3948 
3949 /* This Source Code Form is subject to the terms of the Mozilla Public
3950 * License, v. 2.0. If a copy of the MPL was not distributed with this
3951 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3952 
3953 
3954 #ifdef __cplusplus
3955 extern "C" {
3956 #endif
3957 
3958 
3964 struct UA_NodeStore;
3966 
3970 /* Create a new nodestore */
3972 
3973 /* Delete the nodestore and all nodes in it. Do not call from a read-side
3974  critical section (multithreading). */
3976 
3985 /* Create an editable node of the given NodeClass. */
3987 #define UA_NodeStore_newObjectNode() \
3988  (UA_ObjectNode*)UA_NodeStore_newNode(UA_NODECLASS_OBJECT)
3989 #define UA_NodeStore_newMethodNode() \
3990  (UA_MethodNode*)UA_NodeStore_newNode(UA_NODECLASS_METHOD)
3991 #define UA_NodeStore_newObjectTypeNode() \
3992  (UA_ObjectTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_OBJECTTYPE)
3993 #define UA_NodeStore_newVariableTypeNode() \
3994  (UA_VariableTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_VARIABLETYPE)
3995 #define UA_NodeStore_newReferenceTypeNode() \
3996  (UA_ReferenceTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_REFERENCETYPE)
3997 #define UA_NodeStore_newDataTypeNode() \
3998  (UA_DataTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_DATATYPE)
3999 #define UA_NodeStore_newViewNode() \
4000  (UA_ViewNode*)UA_NodeStore_newNode(UA_NODECLASS_VIEW)
4001 
4002 /* Enable read/write AccessLevel flags for variables by default. More complete
4003  * access control is added starting in the 0.3 branch. */
4004 static UA_VariableNode *
4005 UA_NodeStore_newVariableNode(void) {
4008  if(vn)
4009  vn->accessLevel = 3; /* Enable read/write */
4010  return vn;
4011 }
4012 
4013 /* Delete an editable node. */
4014 void UA_NodeStore_deleteNode(UA_Node *node);
4015 
4019 /* Inserts a new node into the nodestore. If the nodeid is zero, then a fresh
4020  * numeric nodeid from namespace 1 is assigned. If insertion fails, the node is
4021  * deleted. */
4023 
4024 /* The returned node is immutable. */
4025 const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid);
4026 
4027 /* Returns an editable copy of a node (needs to be deleted with the deleteNode
4028  function or inserted / replaced into the nodestore). */
4029 UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid);
4030 
4031 /* To replace a node, get an editable copy of the node, edit and replace with
4032  * this function. If the node was already replaced since the copy was made,
4033  * UA_STATUSCODE_BADINTERNALERROR is returned. If the nodeid is not found,
4034  * UA_STATUSCODE_BADNODEIDUNKNOWN is returned. In both error cases, the editable
4035  * node is deleted. */
4037 
4038 /* Remove a node in the nodestore. */
4040 
4046 typedef void (*UA_NodeStore_nodeVisitor)(const UA_Node *node);
4048 
4049 #ifdef __cplusplus
4050 } // extern "C"
4051 #endif
4052 
4053 
4054 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_session_manager.h" ***********************************/
4055 
4056 /* This Source Code Form is subject to the terms of the Mozilla Public
4057 * License, v. 2.0. If a copy of the MPL was not distributed with this
4058 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4059 
4060 
4061 
4062 typedef struct session_list_entry {
4063  LIST_ENTRY(session_list_entry) pointers;
4064  UA_Session session;
4066 
4067 typedef struct UA_SessionManager {
4068  LIST_HEAD(session_list, session_list_entry) sessions; // doubly-linked list of sessions
4069  UA_UInt32 currentSessionCount;
4070  UA_Server *server;
4072 
4075 
4076 /* Deletes all sessions */
4078 
4079 /* Deletes all sessions that have timed out. Deletion is implemented via a
4080  * delayed callback. So all currently scheduled jobs with a pointer to the
4081  * session can complete. */
4083  UA_DateTime nowMonotonic);
4084 
4087  const UA_CreateSessionRequest *request, UA_Session **session);
4088 
4091 
4092 UA_Session *
4094 
4095 
4096 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_securechannel_manager.h" ***********************************/
4097 
4098 /* This Source Code Form is subject to the terms of the Mozilla Public
4099 * License, v. 2.0. If a copy of the MPL was not distributed with this
4100 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4101 
4102 
4103 
4104 typedef struct channel_list_entry {
4106  LIST_ENTRY(channel_list_entry) pointers;
4108 
4109 typedef struct UA_SecureChannelManager {
4110  LIST_HEAD(channel_list, channel_list_entry) channels; // doubly-linked list of channels
4111  UA_UInt32 currentChannelCount;
4112  UA_UInt32 lastChannelId;
4113  UA_UInt32 lastTokenId;
4114  UA_Server *server;
4116 
4119 
4120 /* Remove a all securechannels */
4121 void
4123 
4124 /* Remove timed out securechannels with a delayed callback. So all currently
4125  * scheduled jobs with a pointer to a securechannel can finish first. */
4126 void
4128  UA_DateTime nowMonotonic);
4129 
4132  const UA_OpenSecureChannelRequest *request,
4133  UA_OpenSecureChannelResponse *response);
4134 
4137  const UA_OpenSecureChannelRequest *request,
4138  UA_OpenSecureChannelResponse *response);
4139 
4142 
4145 
4146 
4147 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_internal.h" ***********************************/
4148 
4149 /* This Source Code Form is subject to the terms of the Mozilla Public
4150 * License, v. 2.0. If a copy of the MPL was not distributed with this
4151 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4152 
4153 
4154 
4155 #define ANONYMOUS_POLICY "open62541-anonymous-policy"
4156 #define USERNAME_POLICY "open62541-username-policy"
4157 
4158 /* The general idea of RCU is to delay freeing nodes (or any callback invoked
4159  * with call_rcu) until all threads have left their critical section. Thus we
4160  * can delete nodes safely in concurrent operations. The macros UA_RCU_LOCK and
4161  * UA_RCU_UNLOCK are used to test during debugging that we do not nest read-side
4162  * critical sections (although this is generally allowed). */
4163 #ifdef UA_ENABLE_MULTITHREADING
4164 # define _LGPL_SOURCE
4165 # include <urcu.h>
4166 # include <urcu/lfstack.h>
4167 # ifdef NDEBUG
4168 # define UA_RCU_LOCK() rcu_read_lock()
4169 # define UA_RCU_UNLOCK() rcu_read_unlock()
4170 # define UA_ASSERT_RCU_LOCKED()
4171 # define UA_ASSERT_RCU_UNLOCKED()
4172 # else
4173  extern UA_THREAD_LOCAL bool rcu_locked;
4174 # define UA_ASSERT_RCU_LOCKED() assert(rcu_locked)
4175 # define UA_ASSERT_RCU_UNLOCKED() assert(!rcu_locked)
4176 # define UA_RCU_LOCK() do { \
4177  UA_ASSERT_RCU_UNLOCKED(); \
4178  rcu_locked = true; \
4179  rcu_read_lock(); } while(0)
4180 # define UA_RCU_UNLOCK() do { \
4181  UA_ASSERT_RCU_LOCKED(); \
4182  rcu_locked = false; \
4183  rcu_read_unlock(); } while(0)
4184 # endif
4185 #else
4186 # define UA_RCU_LOCK()
4187 # define UA_RCU_UNLOCK()
4188 # define UA_ASSERT_RCU_LOCKED()
4189 # define UA_ASSERT_RCU_UNLOCKED()
4190 #endif
4191 
4192 
4193 #ifdef UA_ENABLE_MULTITHREADING
4194 typedef struct {
4195  UA_Server *server;
4196  pthread_t thr;
4197  UA_UInt32 counter;
4198  volatile UA_Boolean running;
4199  char padding[64 - sizeof(void*) - sizeof(pthread_t) -
4200  sizeof(UA_UInt32) - sizeof(UA_Boolean)]; // separate cache lines
4201 } UA_Worker;
4202 #endif
4203 
4204 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
4205 /* Internally used context to a session 'context' of the current mehtod call */
4206 extern UA_THREAD_LOCAL UA_Session* methodCallSession;
4207 #endif
4208 
4209 struct UA_Server {
4210  /* Meta */
4214 
4215  /* Security */
4218 
4219  /* Address Space */
4221 
4224 
4225 
4226  /* Jobs with a repetition interval */
4227  LIST_HEAD(RepeatedJobsList, RepeatedJob) repeatedJobs;
4228 
4229 #ifndef UA_ENABLE_MULTITHREADING
4230  SLIST_HEAD(DelayedJobsList, UA_DelayedJob) delayedCallbacks;
4231 #else
4232  /* Dispatch queue head for the worker threads (the tail should not be in the same cache line) */
4233  struct cds_wfcq_head dispatchQueue_head;
4234  UA_Worker *workers; /* there are nThread workers in a running server */
4235  struct cds_lfs_stack mainLoopJobs; /* Work that shall be executed only in the main loop and not
4236  by worker threads */
4237  struct DelayedJobs *delayedJobs;
4238  pthread_cond_t dispatchQueue_condition; /* so the workers don't spin if the queue is empty */
4239  pthread_mutex_t dispatchQueue_mutex; /* mutex for access to condition variable */
4240  struct cds_wfcq_tail dispatchQueue_tail; /* Dispatch queue tail for the worker threads */
4241 #endif
4242 
4243  /* Config is the last element so that MSVC allows the usernamePasswordLogins
4244  field with zero-sized array */
4245  UA_ServerConfig config;
4246 };
4247 
4248 /*****************/
4249 /* Node Handling */
4250 /*****************/
4251 
4254 
4255 /* Calls callback on the node. In the multithreaded case, the node is copied before and replaced in
4256  the nodestore. */
4258 UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
4259  UA_EditNodeCallback callback, const void *data);
4260 
4261 /********************/
4262 /* Event Processing */
4263 /********************/
4264 
4265 void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
4266  const UA_ByteString *message);
4267 
4268 UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data);
4269 UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data);
4270 void UA_Server_deleteAllRepeatedJobs(UA_Server *server);
4271 
4272 /* Add an existing node. The node is assumed to be "finished", i.e. no
4273  * instantiation from inheritance is necessary. Instantiationcallback and
4274  * addedNodeId may be NULL. */
4276 Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node,
4277  const UA_NodeId *parentNodeId,
4278  const UA_NodeId *referenceTypeId,
4279  const UA_NodeId *typeDefinition,
4280  UA_InstantiationCallback *instantiationCallback,
4281  UA_NodeId *addedNodeId);
4282 
4283 /*********************/
4284 /* Utility Functions */
4285 /*********************/
4286 
4288 parse_numericrange(const UA_String *str, UA_NumericRange *range);
4289 
4290 UA_UInt16 addNamespace(UA_Server *server, const UA_String name);
4291 
4292 UA_Boolean
4293 UA_Node_hasSubTypeOrInstances(const UA_Node *node);
4294 
4295 const UA_VariableTypeNode *
4296 getVariableNodeType(UA_Server *server, const UA_VariableNode *node);
4297 
4298 const UA_ObjectTypeNode *
4299 getObjectNodeType(UA_Server *server, const UA_ObjectNode *node);
4300 
4301 /* Returns an array with all subtype nodeids (including the root). Subtypes need
4302  * to have the same nodeClass as root and are (recursively) related with a
4303  * hasSubType reference. Since multi-inheritance is possible, we test for
4304  * duplicates and return evey nodeid at most once. */
4306 getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
4307  UA_NodeId **typeHierarchy, size_t *typeHierarchySize);
4308 
4309 /* Recursively searches "upwards" in the tree following specific reference types */
4310 UA_Boolean
4311 isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode,
4312  const UA_NodeId *nodeToFind, const UA_NodeId *referenceTypeIds,
4313  size_t referenceTypeIdsSize);
4314 
4315 const UA_Node *
4316 getNodeType(UA_Server *server, const UA_Node *node);
4317 
4318 /***************************************/
4319 /* Check Information Model Consistency */
4320 /***************************************/
4321 
4323 readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v);
4324 
4326 typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId,
4327  UA_Int32 targetValueRank, size_t targetArrayDimensionsSize,
4328  const UA_UInt32 *targetArrayDimensions, const UA_Variant *value,
4329  const UA_NumericRange *range, UA_Variant *editableValue);
4330 
4332 writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node,
4333  const UA_NodeId *dataType, const UA_NodeId *constraintDataType);
4334 
4336 compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
4337  const UA_UInt32 *constraintArrayDimensions,
4338  size_t testArrayDimensionsSize,
4339  const UA_UInt32 *testArrayDimensions);
4340 
4342 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank,
4343  UA_Int32 constraintValueRank);
4344 
4346 writeValueAttribute(UA_Server *server, UA_VariableNode *node,
4347  const UA_DataValue *value, const UA_String *indexRange);
4348 
4349 /*******************/
4350 /* Single-Services */
4351 /*******************/
4352 
4353 /* Some services take an array of "independent" requests. The single-services
4354  are stored here to keep ua_services.h clean for documentation purposes. */
4355 
4356 void Service_Browse_single(UA_Server *server, UA_Session *session,
4357  struct ContinuationPointEntry *cp,
4358  const UA_BrowseDescription *descr,
4359  UA_UInt32 maxrefs, UA_BrowseResult *result);
4360 
4361 void Service_Read_single(UA_Server *server, UA_Session *session,
4362  UA_TimestampsToReturn timestamps,
4363  const UA_ReadValueId *id, UA_DataValue *v);
4364 
4365 void Service_Call_single(UA_Server *server, UA_Session *session,
4366  const UA_CallMethodRequest *request,
4367  UA_CallMethodResult *result);
4368 
4369 
4370 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services.h" ***********************************/
4371 
4372 /* This Source Code Form is subject to the terms of the Mozilla Public
4373 * License, v. 2.0. If a copy of the MPL was not distributed with this
4374 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4375 
4376 
4377 #ifdef __cplusplus
4378 extern "C" {
4379 #endif
4380 
4381 
4400 /* Most services take as input the server, the current session and pointers to
4401  * the request and response structures. Possible error codes are returned as
4402  * part of the response. */
4403 typedef void (*UA_Service)(UA_Server*, UA_Session*,
4404  const void *request, void *response);
4405 
4411 void Service_FindServers(UA_Server *server, UA_Session *session,
4412  const UA_FindServersRequest *request,
4413  UA_FindServersResponse *response);
4414 
4415 /* Returns the Endpoints supported by a Server and all of the configuration
4416  * information required to establish a SecureChannel and a Session. */
4417 void Service_GetEndpoints(UA_Server *server, UA_Session *session,
4418  const UA_GetEndpointsRequest *request,
4419  UA_GetEndpointsResponse *response);
4420 
4421 /* Not Implemented: Service_RegisterServer */
4422 
4429 /* Open or renew a SecureChannel that can be used to ensure Confidentiality and
4430  * Integrity for Message exchange during a Session. */
4431 void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
4432  const UA_OpenSecureChannelRequest *request,
4433  UA_OpenSecureChannelResponse *response);
4434 
4435 /* Used to terminate a SecureChannel. */
4436 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel);
4437 
4443 /* Used by an OPC UA Client to create a Session and the Server returns two
4444  * values which uniquely identify the Session. The first value is the sessionId
4445  * which is used to identify the Session in the audit logs and in the Server's
4446  * address space. The second is the authenticationToken which is used to
4447  * associate an incoming request with a Session. */
4448 void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
4449  const UA_CreateSessionRequest *request,
4450  UA_CreateSessionResponse *response);
4451 
4452 /* Used by the Client to submit its SoftwareCertificates to the Server for
4453  * validation and to specify the identity of the user associated with the
4454  * Session. This Service request shall be issued by the Client before it issues
4455  * any other Service request after CreateSession. Failure to do so shall cause
4456  * the Server to close the Session. */
4457 void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
4458  UA_Session *session,
4459  const UA_ActivateSessionRequest *request,
4460  UA_ActivateSessionResponse *response);
4461 
4462 /* Used to terminate a Session. */
4463 void Service_CloseSession(UA_Server *server, UA_Session *session,
4464  const UA_CloseSessionRequest *request,
4465  UA_CloseSessionResponse *response);
4466 
4467 /* Not Implemented: Service_Cancel */
4468 
4476 /* Used to add one or more Nodes into the AddressSpace hierarchy. */
4477 void Service_AddNodes(UA_Server *server, UA_Session *session,
4478  const UA_AddNodesRequest *request,
4479  UA_AddNodesResponse *response);
4480 
4481 /* Used to add one or more References to one or more Nodes. */
4482 void Service_AddReferences(UA_Server *server, UA_Session *session,
4483  const UA_AddReferencesRequest *request,
4484  UA_AddReferencesResponse *response);
4485 
4486 /* Used to delete one or more Nodes from the AddressSpace. */
4487 void Service_DeleteNodes(UA_Server *server, UA_Session *session,
4488  const UA_DeleteNodesRequest *request,
4489  UA_DeleteNodesResponse *response);
4490 
4491 /* Used to delete one or more References of a Node. */
4492 void Service_DeleteReferences(UA_Server *server, UA_Session *session,
4493  const UA_DeleteReferencesRequest *request,
4494  UA_DeleteReferencesResponse *response);
4495 
4503 /* Used to discover the References of a specified Node. The browse can be
4504  * further limited by the use of a View. This Browse Service also supports a
4505  * primitive filtering capability. */
4506 void Service_Browse(UA_Server *server, UA_Session *session,
4507  const UA_BrowseRequest *request,
4508  UA_BrowseResponse *response);
4509 
4510 /* Used to request the next set of Browse or BrowseNext response information
4511  * that is too large to be sent in a single response. "Too large" in this
4512  * context means that the Server is not able to return a larger response or that
4513  * the number of results to return exceeds the maximum number of results to
4514  * return that was specified by the Client in the original Browse request. */
4515 void Service_BrowseNext(UA_Server *server, UA_Session *session,
4516  const UA_BrowseNextRequest *request,
4517  UA_BrowseNextResponse *response);
4518 
4519 /* Used to translate textual node paths to their respective ids. */
4520 void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
4523 
4524 /* Used by Clients to register the Nodes that they know they will access
4525  * repeatedly (e.g. Write, Call). It allows Servers to set up anything needed so
4526  * that the access operations will be more efficient. */
4527 void Service_RegisterNodes(UA_Server *server, UA_Session *session,
4528  const UA_RegisterNodesRequest *request,
4529  UA_RegisterNodesResponse *response);
4530 
4531 /* This Service is used to unregister NodeIds that have been obtained via the
4532  * RegisterNodes service. */
4533 void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
4534  const UA_UnregisterNodesRequest *request,
4535  UA_UnregisterNodesResponse *response);
4536 
4547 /* Not Implemented: Service_QueryFirst */
4548 /* Not Impelemented: Service_QueryNext */
4549 
4555 /* Used to read one or more Attributes of one or more Nodes. For constructed
4556  * Attribute values whose elements are indexed, such as an array, this Service
4557  * allows Clients to read the entire set of indexed values as a composite, to
4558  * read individual elements or to read ranges of elements of the composite. */
4559 void Service_Read(UA_Server *server, UA_Session *session,
4560  const UA_ReadRequest *request,
4561  UA_ReadResponse *response);
4562 
4563 /* Used to write one or more Attributes of one or more Nodes. For constructed
4564  * Attribute values whose elements are indexed, such as an array, this Service
4565  * allows Clients to write the entire set of indexed values as a composite, to
4566  * write individual elements or to write ranges of elements of the composite. */
4567 void Service_Write(UA_Server *server, UA_Session *session,
4568  const UA_WriteRequest *request,
4569  UA_WriteResponse *response);
4570 
4571 /* Not Implemented: Service_HistoryRead */
4572 /* Not Implemented: Service_HistoryUpdate */
4573 
4582 /* Used to call (invoke) a list of Methods. Each method call is invoked within
4583  * the context of an existing Session. If the Session is terminated, the results
4584  * of the method's execution cannot be returned to the Client and are
4585  * discarded. */
4586 void Service_Call(UA_Server *server, UA_Session *session,
4587  const UA_CallRequest *request,
4588  UA_CallResponse *response);
4589 
4596 /* Used to create and add one or more MonitoredItems to a Subscription. A
4597  * MonitoredItem is deleted automatically by the Server when the Subscription is
4598  * deleted. Deleting a MonitoredItem causes its entire set of triggered item
4599  * links to be deleted, but has no effect on the MonitoredItems referenced by
4600  * the triggered items. */
4601 void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
4602  const UA_CreateMonitoredItemsRequest *request,
4604 
4605 /* Used to remove one or more MonitoredItems of a Subscription. When a
4606  * MonitoredItem is deleted, its triggered item links are also deleted. */
4607 void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
4608  const UA_DeleteMonitoredItemsRequest *request,
4610 
4611 void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
4612  const UA_ModifyMonitoredItemsRequest *request,
4614 
4615 /* Used to set the monitoring mode for one or more MonitoredItems of a
4616  Subscription. */
4617 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
4618  const UA_SetMonitoringModeRequest *request,
4619  UA_SetMonitoringModeResponse *response);
4620 
4621 /* Not Implemented: Service_SetTriggering */
4622 
4627 /* Used to create a Subscription. Subscriptions monitor a set of MonitoredItems
4628  * for Notifications and return them to the Client in response to Publish
4629  * requests. */
4630 void Service_CreateSubscription(UA_Server *server, UA_Session *session,
4631  const UA_CreateSubscriptionRequest *request,
4632  UA_CreateSubscriptionResponse *response);
4633 
4634 /* Used to modify a Subscription. */
4635 void Service_ModifySubscription(UA_Server *server, UA_Session *session,
4636  const UA_ModifySubscriptionRequest *request,
4637  UA_ModifySubscriptionResponse *response);
4638 
4639 /* Used to enable sending of Notifications on one or more Subscriptions. */
4640 void Service_SetPublishingMode(UA_Server *server, UA_Session *session,
4641  const UA_SetPublishingModeRequest *request,
4642  UA_SetPublishingModeResponse *response);
4643 
4644 /* Used for two purposes. First, it is used to acknowledge the receipt of
4645  * NotificationMessages for one or more Subscriptions. Second, it is used to
4646  * request the Server to return a NotificationMessage or a keep-alive
4647  * Message.
4648  *
4649  * Note that the service signature is an exception and does not contain a
4650  * pointer to a PublishResponse. That is because the service queues up publish
4651  * requests internally and sends responses asynchronously based on timeouts. */
4652 void Service_Publish(UA_Server *server, UA_Session *session,
4653  const UA_PublishRequest *request, UA_UInt32 requestId);
4654 
4655 /* Requests the Subscription to republish a NotificationMessage from its
4656  * retransmission queue. */
4657 void Service_Republish(UA_Server *server, UA_Session *session,
4658  const UA_RepublishRequest *request,
4659  UA_RepublishResponse *response);
4660 
4661 /* Invoked to delete one or more Subscriptions that belong to the Client's
4662  * Session. */
4663 void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
4664  const UA_DeleteSubscriptionsRequest *request,
4665  UA_DeleteSubscriptionsResponse *response);
4666 
4667 /* Not Implemented: Service_TransferSubscription */
4668 
4669 #ifdef __cplusplus
4670 } // extern "C"
4671 #endif
4672 
4673 
4674 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_internal.h" ***********************************/
4675 
4676 /* This Source Code Form is subject to the terms of the Mozilla Public
4677 * License, v. 2.0. If a copy of the MPL was not distributed with this
4678 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4679 
4680 
4681 
4682 /**************************/
4683 /* Subscriptions Handling */
4684 /**************************/
4685 
4686 #ifdef UA_ENABLE_SUBSCRIPTIONS
4687 
4688 typedef struct UA_Client_NotificationsAckNumber {
4689  LIST_ENTRY(UA_Client_NotificationsAckNumber) listEntry;
4691 } UA_Client_NotificationsAckNumber;
4692 
4693 typedef struct UA_Client_MonitoredItem {
4694  LIST_ENTRY(UA_Client_MonitoredItem) listEntry;
4695  UA_UInt32 monitoredItemId;
4696  UA_UInt32 monitoringMode;
4697  UA_NodeId monitoredNodeId;
4698  UA_UInt32 attributeID;
4699  UA_UInt32 clientHandle;
4700  UA_Double samplingInterval;
4701  UA_UInt32 queueSize;
4702  UA_Boolean discardOldest;
4703  void (*handler)(UA_UInt32 monId, UA_DataValue *value, void *context);
4704  void *handlerContext;
4705 } UA_Client_MonitoredItem;
4706 
4707 typedef struct UA_Client_Subscription {
4708  LIST_ENTRY(UA_Client_Subscription) listEntry;
4709  UA_UInt32 lifeTime;
4710  UA_UInt32 keepAliveCount;
4711  UA_Double publishingInterval;
4712  UA_UInt32 subscriptionID;
4713  UA_UInt32 notificationsPerPublish;
4714  UA_UInt32 priority;
4715  LIST_HEAD(UA_ListOfClientMonitoredItems, UA_Client_MonitoredItem) monitoredItems;
4716 } UA_Client_Subscription;
4717 
4718 void UA_Client_Subscriptions_forceDelete(UA_Client *client, UA_Client_Subscription *sub);
4719 
4720 #endif
4721 
4722 /**********/
4723 /* Client */
4724 /**********/
4725 
4726 typedef enum {
4730 
4731 struct UA_Client {
4732  /* State */
4733  UA_ClientState state;
4734  UA_ClientConfig config;
4735 
4736  /* Connection */
4739 
4740  /* SecureChannel */
4744 
4745  /* Authentication */
4746  UA_Client_Authentication authenticationMethod;
4749 
4750  /* Session */
4754 
4755  /* Subscriptions */
4756 #ifdef UA_ENABLE_SUBSCRIPTIONS
4757  UA_UInt32 monitoredItemHandles;
4758  LIST_HEAD(ListOfUnacknowledgedNotifications, UA_Client_NotificationsAckNumber) pendingNotificationsAcks;
4759  LIST_HEAD(ListOfClientSubscriptionItems, UA_Client_Subscription) subscriptions;
4760 #endif
4761 };
4762 
4763 
4764 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types.c" ***********************************/
4765 
4766 /* This Source Code Form is subject to the terms of the Mozilla Public
4767 * License, v. 2.0. If a copy of the MPL was not distributed with this
4768 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4769 
4770 
4771 
4772 /* Datatype Handling
4773  * -----------------
4774  * This file contains handling functions for the builtin types and functions
4775  * handling of structured types and arrays. These need type descriptions in a
4776  * UA_DataType structure. The UA_DataType structures as well as all non-builtin
4777  * datatypes are autogenerated. */
4778 
4779 /* Global definition of NULL type instances. These are always zeroed out, as
4780  * mandated by the C/C++ standard for global values with no initializer. */
4786 
4787 /* TODO: The standard-defined types are ordered. See if binary search is more
4788  * efficient. */
4789 const UA_DataType *
4790 UA_findDataType(const UA_NodeId *typeId) {
4791  for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
4792  if(UA_TYPES[i].typeId.identifier.numeric == typeId->identifier.numeric)
4793  return &UA_TYPES[i];
4794  }
4795  return NULL;
4796 }
4797 
4798 /***************************/
4799 /* Random Number Generator */
4800 /***************************/
4801 
4803 
4804 void
4806  pcg32_srandom_r(&UA_rng, seed, (uint64_t)UA_DateTime_now());
4807 }
4808 
4809 UA_UInt32
4811  return (UA_UInt32)pcg32_random_r(&UA_rng);
4812 }
4813 
4814 /*****************/
4815 /* Builtin Types */
4816 /*****************/
4817 
4818 static void deleteMembers_noInit(void *p, const UA_DataType *type);
4819 static UA_StatusCode copy_noInit(const void *src, void *dst, const UA_DataType *type);
4820 
4821 UA_String
4822 UA_String_fromChars(char const src[]) {
4823  UA_String str = UA_STRING_NULL;
4824  size_t length = strlen(src);
4825  if(length > 0) {
4826  str.data = (UA_Byte*)UA_malloc(length);
4827  if(!str.data)
4828  return str;
4829  } else {
4831  }
4832  memcpy(str.data, src, length);
4833  str.length = length;
4834  return str;
4835 }
4836 
4837 UA_Boolean
4838 UA_String_equal(const UA_String *s1, const UA_String *s2) {
4839  if(s1->length != s2->length)
4840  return false;
4841  UA_Int32 is = memcmp((char const*)s1->data,
4842  (char const*)s2->data, s1->length);
4843  return (is == 0) ? true : false;
4844 }
4845 
4846 static void
4847 String_deleteMembers(UA_String *s, const UA_DataType *_) {
4848  UA_free((void*)((uintptr_t)s->data & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
4849 }
4850 
4851 /* DateTime */
4854  /* Calculating the the milli-, micro- and nanoseconds */
4855  UA_DateTimeStruct dateTimeStruct;
4856  dateTimeStruct.nanoSec = (UA_UInt16)((t % 10) * 100);
4857  dateTimeStruct.microSec = (UA_UInt16)((t % 10000) / 10);
4858  dateTimeStruct.milliSec = (UA_UInt16)((t % 10000000) / 10000);
4859 
4860  /* Calculating the unix time with #include <time.h> */
4861  time_t secSinceUnixEpoch =
4862  (time_t)((t - UA_DATETIME_UNIX_EPOCH) / UA_SEC_TO_DATETIME);
4863  struct tm ts;
4864  memset(&ts, 0, sizeof(struct tm));
4865  __secs_to_tm(secSinceUnixEpoch, &ts);
4866  dateTimeStruct.sec = (UA_UInt16)ts.tm_sec;
4867  dateTimeStruct.min = (UA_UInt16)ts.tm_min;
4868  dateTimeStruct.hour = (UA_UInt16)ts.tm_hour;
4869  dateTimeStruct.day = (UA_UInt16)ts.tm_mday;
4870  dateTimeStruct.month = (UA_UInt16)(ts.tm_mon + 1);
4871  dateTimeStruct.year = (UA_UInt16)(ts.tm_year + 1900);
4872  return dateTimeStruct;
4873 }
4874 
4875 static void
4876 printNumber(UA_UInt16 n, UA_Byte *pos, size_t digits) {
4877  for(size_t i = digits; i > 0; --i) {
4878  pos[i-1] = (UA_Byte)((n % 10) + '0');
4879  n = n / 10;
4880  }
4881 }
4882 
4883 UA_String
4885  UA_String str = UA_STRING_NULL;
4886  // length of the string is 31 (plus \0 at the end)
4887  if(!(str.data = (UA_Byte*)UA_malloc(32)))
4888  return str;
4889  str.length = 31;
4891  printNumber(tSt.month, str.data, 2);
4892  str.data[2] = '/';
4893  printNumber(tSt.day, &str.data[3], 2);
4894  str.data[5] = '/';
4895  printNumber(tSt.year, &str.data[6], 4);
4896  str.data[10] = ' ';
4897  printNumber(tSt.hour, &str.data[11], 2);
4898  str.data[13] = ':';
4899  printNumber(tSt.min, &str.data[14], 2);
4900  str.data[16] = ':';
4901  printNumber(tSt.sec, &str.data[17], 2);
4902  str.data[19] = '.';
4903  printNumber(tSt.milliSec, &str.data[20], 3);
4904  str.data[23] = '.';
4905  printNumber(tSt.microSec, &str.data[24], 3);
4906  str.data[27] = '.';
4907  printNumber(tSt.nanoSec, &str.data[28], 3);
4908  return str;
4909 }
4910 
4911 /* Guid */
4912 UA_Boolean
4913 UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2) {
4914  if(memcmp(g1, g2, sizeof(UA_Guid)) == 0)
4915  return true;
4916  return false;
4917 }
4918 
4919 UA_Guid
4921  UA_Guid result;
4922  result.data1 = (UA_UInt32)pcg32_random_r(&UA_rng);
4923  UA_UInt32 r = (UA_UInt32)pcg32_random_r(&UA_rng);
4924  result.data2 = (UA_UInt16) r;
4925  result.data3 = (UA_UInt16) (r >> 16);
4926  r = (UA_UInt32)pcg32_random_r(&UA_rng);
4927  result.data4[0] = (UA_Byte)r;
4928  result.data4[1] = (UA_Byte)(r >> 4);
4929  result.data4[2] = (UA_Byte)(r >> 8);
4930  result.data4[3] = (UA_Byte)(r >> 12);
4931  r = (UA_UInt32)pcg32_random_r(&UA_rng);
4932  result.data4[4] = (UA_Byte)r;
4933  result.data4[5] = (UA_Byte)(r >> 4);
4934  result.data4[6] = (UA_Byte)(r >> 8);
4935  result.data4[7] = (UA_Byte)(r >> 12);
4936  return result;
4937 }
4938 
4939 /* ByteString */
4942  UA_ByteString_init(bs);
4943  if(length == 0)
4944  return UA_STATUSCODE_GOOD;
4945  if(!(bs->data = (UA_Byte*)UA_malloc(length)))
4947  bs->length = length;
4948  return UA_STATUSCODE_GOOD;
4949 }
4950 
4951 /* NodeId */
4952 static void
4953 NodeId_deleteMembers(UA_NodeId *p, const UA_DataType *_) {
4954  switch(p->identifierType) {
4955  case UA_NODEIDTYPE_STRING:
4957  String_deleteMembers(&p->identifier.string, NULL);
4958  break;
4959  default: break;
4960  }
4961 }
4962 
4963 static UA_StatusCode
4964 NodeId_copy(UA_NodeId const *src, UA_NodeId *dst, const UA_DataType *_) {
4966  switch(src->identifierType) {
4967  case UA_NODEIDTYPE_NUMERIC:
4968  *dst = *src;
4969  return UA_STATUSCODE_GOOD;
4970  case UA_NODEIDTYPE_STRING:
4971  retval |= UA_String_copy(&src->identifier.string,
4972  &dst->identifier.string);
4973  break;
4974  case UA_NODEIDTYPE_GUID:
4975  retval |= UA_Guid_copy(&src->identifier.guid, &dst->identifier.guid);
4976  break;
4978  retval |= UA_ByteString_copy(&src->identifier.byteString,
4979  &dst->identifier.byteString);
4980  break;
4981  default:
4983  }
4984  dst->namespaceIndex = src->namespaceIndex;
4985  dst->identifierType = src->identifierType;
4986  return retval;
4987 }
4988 
4989 UA_Boolean
4991  if(p->namespaceIndex != 0)
4992  return false;
4993  switch(p->identifierType) {
4994  case UA_NODEIDTYPE_NUMERIC:
4995  return (p->identifier.numeric == 0);
4996  case UA_NODEIDTYPE_GUID:
4997  return (p->identifier.guid.data1 == 0 &&
4998  p->identifier.guid.data2 == 0 &&
4999  p->identifier.guid.data3 == 0 &&
5000  p->identifier.guid.data4[0] == 0 &&
5001  p->identifier.guid.data4[1] == 0 &&
5002  p->identifier.guid.data4[2] == 0 &&
5003  p->identifier.guid.data4[3] == 0 &&
5004  p->identifier.guid.data4[4] == 0 &&
5005  p->identifier.guid.data4[5] == 0 &&
5006  p->identifier.guid.data4[6] == 0 &&
5007  p->identifier.guid.data4[7] == 0);
5008  default:
5009  break;
5010  }
5011  return (p->identifier.string.length == 0);
5012 }
5013 
5014 UA_Boolean
5015 UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2) {
5016  if(n1->namespaceIndex != n2->namespaceIndex ||
5017  n1->identifierType!=n2->identifierType)
5018  return false;
5019  switch(n1->identifierType) {
5020  case UA_NODEIDTYPE_NUMERIC:
5021  if(n1->identifier.numeric == n2->identifier.numeric)
5022  return true;
5023  else
5024  return false;
5025  case UA_NODEIDTYPE_STRING:
5026  return UA_String_equal(&n1->identifier.string,
5027  &n2->identifier.string);
5028  case UA_NODEIDTYPE_GUID:
5029  return UA_Guid_equal(&n1->identifier.guid,
5030  &n2->identifier.guid);
5032  return UA_ByteString_equal(&n1->identifier.byteString,
5033  &n2->identifier.byteString);
5034  }
5035  return false;
5036 }
5037 
5038 /* FNV non-cryptographic hash function. See
5039  * https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function */
5040 #define FNV_PRIME_32 16777619
5041 static UA_UInt32
5042 fnv32(UA_UInt32 fnv, const UA_Byte *buf, size_t size) {
5043  for(size_t i = 0; i < size; ++i) {
5044  fnv = fnv ^ (buf[i]);
5045  fnv = fnv * FNV_PRIME_32;
5046  }
5047  return fnv;
5048 }
5049 
5050 UA_UInt32
5052  switch(n->identifierType) {
5053  case UA_NODEIDTYPE_NUMERIC:
5054  default:
5055  return (UA_UInt32)(n->namespaceIndex + (n->identifier.numeric * 2654435761)); /* Knuth's multiplicative hashing */
5056  case UA_NODEIDTYPE_STRING:
5058  return fnv32(n->namespaceIndex, n->identifier.string.data, n->identifier.string.length);
5059  case UA_NODEIDTYPE_GUID:
5060  return fnv32(n->namespaceIndex, (const UA_Byte*)&n->identifier.guid, sizeof(UA_Guid));
5061  }
5062 }
5063 
5064 /* ExpandedNodeId */
5065 static void
5066 ExpandedNodeId_deleteMembers(UA_ExpandedNodeId *p, const UA_DataType *_) {
5067  NodeId_deleteMembers(&p->nodeId, _);
5068  String_deleteMembers(&p->namespaceUri, NULL);
5069 }
5070 
5071 static UA_StatusCode
5072 ExpandedNodeId_copy(UA_ExpandedNodeId const *src, UA_ExpandedNodeId *dst,
5073  const UA_DataType *_) {
5074  UA_StatusCode retval = NodeId_copy(&src->nodeId, &dst->nodeId, NULL);
5075  retval |= UA_String_copy(&src->namespaceUri, &dst->namespaceUri);
5076  dst->serverIndex = src->serverIndex;
5077  return retval;
5078 }
5079 
5080 /* ExtensionObject */
5081 static void
5082 ExtensionObject_deleteMembers(UA_ExtensionObject *p, const UA_DataType *_) {
5083  switch(p->encoding) {
5087  NodeId_deleteMembers(&p->content.encoded.typeId, NULL);
5088  String_deleteMembers(&p->content.encoded.body, NULL);
5089  break;
5091  if(p->content.decoded.data)
5092  UA_delete(p->content.decoded.data, p->content.decoded.type);
5093  break;
5094  default:
5095  break;
5096  }
5097 }
5098 
5099 static UA_StatusCode
5100 ExtensionObject_copy(UA_ExtensionObject const *src, UA_ExtensionObject *dst,
5101  const UA_DataType *_) {
5103  switch(src->encoding) {
5107  dst->encoding = src->encoding;
5108  retval = NodeId_copy(&src->content.encoded.typeId,
5109  &dst->content.encoded.typeId, NULL);
5110  retval |= UA_ByteString_copy(&src->content.encoded.body,
5111  &dst->content.encoded.body);
5112  break;
5115  if(!src->content.decoded.type || !src->content.decoded.data)
5118  dst->content.decoded.type = src->content.decoded.type;
5119  retval = UA_Array_copy(src->content.decoded.data, 1,
5120  &dst->content.decoded.data, src->content.decoded.type);
5121  break;
5122  default:
5123  break;
5124  }
5125  return retval;
5126 }
5127 
5128 /* Variant */
5129 static void
5130 Variant_deletemembers(UA_Variant *p, const UA_DataType *_) {
5131  if(p->storageType != UA_VARIANT_DATA)
5132  return;
5133  if(p->type && p->data > UA_EMPTY_ARRAY_SENTINEL) {
5134  if(p->arrayLength == 0)
5135  p->arrayLength = 1;
5136  UA_Array_delete(p->data, p->arrayLength, p->type);
5137  }
5140 }
5141 
5142 static UA_StatusCode
5143 Variant_copy(UA_Variant const *src, UA_Variant *dst, const UA_DataType *_) {
5144  size_t length = src->arrayLength;
5145  if(UA_Variant_isScalar(src))
5146  length = 1;
5147  UA_StatusCode retval = UA_Array_copy(src->data, length,
5148  &dst->data, src->type);
5149  if(retval != UA_STATUSCODE_GOOD)
5150  return retval;
5151  dst->arrayLength = src->arrayLength;
5152  dst->type = src->type;
5153  if(src->arrayDimensions) {
5155  (void**)&dst->arrayDimensions, &UA_TYPES[UA_TYPES_INT32]);
5156  if(retval != UA_STATUSCODE_GOOD)
5157  return retval;
5159  }
5160  return UA_STATUSCODE_GOOD;
5161 }
5162 
5163 void
5165  const UA_DataType *type) {
5166  UA_Variant_init(v);
5167  v->type = type;
5168  v->arrayLength = 0;
5169  v->data = p;
5170 }
5171 
5174  const UA_DataType *type) {
5175  void *n = UA_malloc(type->memSize);
5176  if(!n)
5178  UA_StatusCode retval = UA_copy(p, n, type);
5179  if(retval != UA_STATUSCODE_GOOD) {
5180  UA_free(n);
5181  //cppcheck-suppress memleak
5182  return retval;
5183  }
5184  UA_Variant_setScalar(v, n, type);
5185  //cppcheck-suppress memleak
5186  return UA_STATUSCODE_GOOD;
5187 }
5188 
5190  size_t arraySize, const UA_DataType *type) {
5191  UA_Variant_init(v);
5192  v->data = array;
5193  v->arrayLength = arraySize;
5194  v->type = type;
5195 }
5196 
5198 UA_Variant_setArrayCopy(UA_Variant *v, const void *array,
5199  size_t arraySize, const UA_DataType *type) {
5200  UA_Variant_init(v);
5201  UA_StatusCode retval = UA_Array_copy(array, arraySize, &v->data, type);
5202  if(retval != UA_STATUSCODE_GOOD)
5203  return retval;
5204  v->arrayLength = arraySize;
5205  v->type = type;
5206  return UA_STATUSCODE_GOOD;
5207 }
5208 
5209 /* Test if a range is compatible with a variant. If yes, the following values
5210  * are set:
5211  * - total: how many elements are in the range
5212  * - block: how big is each contiguous block of elements in the variant that
5213  * maps into the range
5214  * - stride: how many elements are between the blocks (beginning to beginning)
5215  * - first: where does the first block begin */
5216 static UA_StatusCode
5217 computeStrides(const UA_Variant *v, const UA_NumericRange range,
5218  size_t *total, size_t *block, size_t *stride, size_t *first) {
5219  /* Test for max array size */
5220 #if(MAX_SIZE > 0xffffffff) /* 64bit only */
5221  if(v->arrayLength > UA_UINT32_MAX)
5223 #endif
5224 
5225  /* Test the integrity of the source variant dimensions, make dimensions
5226  * vector of one dimension if none defined */
5227  UA_UInt32 arrayLength = (UA_UInt32)v->arrayLength;
5228  const UA_UInt32 *dims = &arrayLength;
5229  size_t dims_count = 1;
5230  if(v->arrayDimensionsSize > 0) {
5231  size_t elements = 1;
5232  dims_count = v->arrayDimensionsSize;
5233  dims = (UA_UInt32*)v->arrayDimensions;
5234  for(size_t i = 0; i < dims_count; ++i)
5235  elements *= dims[i];
5236  if(elements != v->arrayLength)
5238  }
5239  UA_assert(dims_count > 0);
5240 
5241  /* Test the integrity of the range and compute the max index used for every
5242  * dimension. The standard says in Part 4, Section 7.22:
5243  *
5244  * When reading a value, the indexes may not specify a range that is within
5245  * the bounds of the array. The Server shall return a partial result if some
5246  * elements exist within the range. */
5247  size_t count = 1;
5248  UA_UInt32 *realmax = UA_alloca(sizeof(UA_UInt32) * dims_count);
5249  if(range.dimensionsSize != dims_count)
5251  for(size_t i = 0; i < dims_count; ++i) {
5252  if(range.dimensions[i].min > range.dimensions[i].max)
5254  if(range.dimensions[i].min >= dims[i])
5256 
5257  if(range.dimensions[i].max < dims[i])
5258  realmax[i] = range.dimensions[i].max;
5259  else
5260  realmax[i] = dims[i] - 1;
5261 
5262  count *= (realmax[i] - range.dimensions[i].min) + 1;
5263  }
5264 
5265  *total = count;
5266 
5267  /* Compute the stride length and the position of the first element */
5268  *block = count; /* Assume the range describes the entire array. */
5269  *stride = v->arrayLength; /* So it can be copied as a contiguous block. */
5270  *first = 0;
5271  size_t running_dimssize = 1;
5272  UA_Boolean found_contiguous = false;
5273  for(size_t k = dims_count; k > 0;) {
5274  --k;
5275  size_t dimrange = 1 + realmax[k] - range.dimensions[k].min;
5276  if(!found_contiguous && dimrange != dims[k]) {
5277  /* Found the maximum block that can be copied contiguously */
5278  found_contiguous = true;
5279  *block = running_dimssize * dimrange;
5280  *stride = running_dimssize * dims[k];
5281  }
5282  *first += running_dimssize * range.dimensions[k].min;
5283  running_dimssize *= dims[k];
5284  }
5285  return UA_STATUSCODE_GOOD;
5286 }
5287 
5288 /* Is the type string-like? */
5289 static UA_Boolean
5290 isStringLike(const UA_DataType *type) {
5291  if(type->membersSize == 1 && type->members[0].isArray &&
5292  type->members[0].namespaceZero &&
5294  return true;
5295  return false;
5296 }
5297 
5298 /* Returns the part of the string that lies within the rangedimension */
5299 static UA_StatusCode
5300 copySubString(const UA_String *src, UA_String *dst,
5301  const UA_NumericRangeDimension *dim) {
5302  if(dim->min > dim->max)
5304  if(dim->min >= src->length)
5306 
5307  size_t length;
5308  if(dim->max < src->length)
5309  length = dim->max - dim->min + 1;
5310  else
5311  length = src->length - dim->min;
5312 
5313  UA_StatusCode retval = UA_ByteString_allocBuffer(dst, length);
5314  if(retval != UA_STATUSCODE_GOOD)
5315  return retval;
5316 
5317  memcpy(dst->data, &src->data[dim->min], length);
5318  return UA_STATUSCODE_GOOD;
5319 }
5320 
5323  const UA_NumericRange range) {
5324  UA_Boolean isScalar = UA_Variant_isScalar(src);
5325  UA_Boolean stringLike = isStringLike(src->type);
5326  UA_Variant arraySrc;
5327 
5328  /* Extract the range for copying at this level. The remaining range is dealt
5329  * with in the "scalar" type that may define an array by itself (string,
5330  * variant, ...). */
5331  UA_NumericRange thisrange, nextrange;
5332  UA_NumericRangeDimension scalarThisDimension = {0,0}; /* a single entry */
5333  if(isScalar) {
5334  /* Replace scalar src with array of length 1 */
5335  arraySrc = *src;
5336  arraySrc.arrayLength = 1;
5337  src = &arraySrc;
5338  /* Deal with all range dimensions within the scalar */
5339  thisrange.dimensions = &scalarThisDimension;
5340  thisrange.dimensionsSize = 1;
5341  nextrange = range;
5342  } else {
5343  /* Deal with as many range dimensions as possible right now */
5344  size_t dims = src->arrayDimensionsSize;
5345  if(dims == 0)
5346  dims = 1;
5347  if(dims > range.dimensionsSize)
5349  thisrange = range;
5350  thisrange.dimensionsSize = dims;
5351  nextrange.dimensions = &range.dimensions[dims];
5352  nextrange.dimensionsSize = range.dimensionsSize - dims;
5353  }
5354 
5355  /* Compute the strides */
5356  size_t count, block, stride, first;
5357  UA_StatusCode retval = computeStrides(src, thisrange, &count,
5358  &block, &stride, &first);
5359  if(retval != UA_STATUSCODE_GOOD)
5360  return retval;
5361 
5362  /* Allocate the array */
5363  UA_Variant_init(dst);
5364  dst->data = UA_Array_new(count, src->type);
5365  if(!dst->data)
5367 
5368  /* Copy the range */
5369  size_t block_count = count / block;
5370  size_t elem_size = src->type->memSize;
5371  uintptr_t nextdst = (uintptr_t)dst->data;
5372  uintptr_t nextsrc = (uintptr_t)src->data + (elem_size * first);
5373  if(nextrange.dimensionsSize == 0) {
5374  /* no nextrange */
5375  if(src->type->fixedSize) {
5376  for(size_t i = 0; i < block_count; ++i) {
5377  memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
5378  nextdst += block * elem_size;
5379  nextsrc += stride * elem_size;
5380  }
5381  } else {
5382  for(size_t i = 0; i < block_count; ++i) {
5383  for(size_t j = 0; j < block; ++j) {
5384  retval = UA_copy((const void*)nextsrc,
5385  (void*)nextdst, src->type);
5386  nextdst += elem_size;
5387  nextsrc += elem_size;
5388  }
5389  nextsrc += (stride - block) * elem_size;
5390  }
5391  }
5392  } else {
5393  /* nextrange can only be used for variants and stringlike with remaining
5394  * range of dimension 1 */
5395  if(src->type != &UA_TYPES[UA_TYPES_VARIANT]) {
5396  if(!stringLike)
5398  if(nextrange.dimensionsSize != 1)
5400  }
5401 
5402  /* Copy the content */
5403  for(size_t i = 0; i < block_count; ++i) {
5404  for(size_t j = 0; j < block && retval == UA_STATUSCODE_GOOD; ++j) {
5405  if(stringLike)
5406  retval = copySubString((const UA_String*)nextsrc,
5407  (UA_String*)nextdst,
5408  nextrange.dimensions);
5409  else
5410  retval = UA_Variant_copyRange((const UA_Variant*)nextsrc,
5411  (UA_Variant*)nextdst,
5412  nextrange);
5413  nextdst += elem_size;
5414  nextsrc += elem_size;
5415  }
5416  nextsrc += (stride - block) * elem_size;
5417  }
5418  }
5419 
5420  /* Clean up if copying failed */
5421  if(retval != UA_STATUSCODE_GOOD) {
5422  UA_Array_delete(dst->data, count, src->type);
5423  dst->data = NULL;
5424  return retval;
5425  }
5426 
5427  /* Done if scalar */
5428  dst->type = src->type;
5429  if(isScalar)
5430  return retval;
5431 
5432  /* Copy array dimensions */
5433  dst->arrayLength = count;
5434  if(src->arrayDimensionsSize > 0) {
5435  dst->arrayDimensions =
5437  if(!dst->arrayDimensions) {
5438  Variant_deletemembers(dst, NULL);
5440  }
5441  dst->arrayDimensionsSize = thisrange.dimensionsSize;
5442  for(size_t k = 0; k < thisrange.dimensionsSize; ++k)
5443  dst->arrayDimensions[k] =
5444  thisrange.dimensions[k].max - thisrange.dimensions[k].min + 1;
5445  }
5446  return UA_STATUSCODE_GOOD;
5447 }
5448 
5449 /* TODO: Allow ranges to reach inside a scalars that are array-like, e.g.
5450  * variant and strings. This is already possible for reading... */
5451 static UA_StatusCode
5452 Variant_setRange(UA_Variant *v, void *array, size_t arraySize,
5453  const UA_NumericRange range, UA_Boolean copy) {
5454  /* Compute the strides */
5455  size_t count, block, stride, first;
5456  UA_StatusCode retval = computeStrides(v, range, &count,
5457  &block, &stride, &first);
5458  if(retval != UA_STATUSCODE_GOOD)
5459  return retval;
5460  if(count != arraySize)
5462 
5463  /* Move/copy the elements */
5464  size_t block_count = count / block;
5465  size_t elem_size = v->type->memSize;
5466  uintptr_t nextdst = (uintptr_t)v->data + (first * elem_size);
5467  uintptr_t nextsrc = (uintptr_t)array;
5468  if(v->type->fixedSize || !copy) {
5469  for(size_t i = 0; i < block_count; ++i) {
5470  memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
5471  nextsrc += block * elem_size;
5472  nextdst += stride * elem_size;
5473  }
5474  } else {
5475  for(size_t i = 0; i < block_count; ++i) {
5476  for(size_t j = 0; j < block; ++j) {
5477  deleteMembers_noInit((void*)nextdst, v->type);
5478  retval |= UA_copy((void*)nextsrc, (void*)nextdst, v->type);
5479  nextdst += elem_size;
5480  nextsrc += elem_size;
5481  }
5482  nextdst += (stride - block) * elem_size;
5483  }
5484  }
5485 
5486  /* If members were moved, initialize original array to prevent reuse */
5487  if(!copy && !v->type->fixedSize)
5488  memset(array, 0, sizeof(elem_size)*arraySize);
5489 
5490  return retval;
5491 }
5492 
5495  size_t arraySize, const UA_NumericRange range) {
5496  return Variant_setRange(v, array, arraySize, range, false);
5497 }
5498 
5500 UA_Variant_setRangeCopy(UA_Variant *v, const void *array,
5501  size_t arraySize, const UA_NumericRange range) {
5502  return Variant_setRange(v, (void*)(uintptr_t)array,
5503  arraySize, range, true);
5504 }
5505 
5506 /* LocalizedText */
5507 static void
5508 LocalizedText_deleteMembers(UA_LocalizedText *p, const UA_DataType *_) {
5509  String_deleteMembers(&p->locale, NULL);
5510  String_deleteMembers(&p->text, NULL);
5511 }
5512 
5513 static UA_StatusCode
5514 LocalizedText_copy(UA_LocalizedText const *src, UA_LocalizedText *dst,
5515  const UA_DataType *_) {
5516  UA_StatusCode retval = UA_String_copy(&src->locale, &dst->locale);
5517  retval |= UA_String_copy(&src->text, &dst->text);
5518  return retval;
5519 }
5520 
5521 /* DataValue */
5522 static void
5523 DataValue_deleteMembers(UA_DataValue *p, const UA_DataType *_) {
5524  Variant_deletemembers(&p->value, NULL);
5525 }
5526 
5527 static UA_StatusCode
5528 DataValue_copy(UA_DataValue const *src, UA_DataValue *dst,
5529  const UA_DataType *_) {
5530  memcpy(dst, src, sizeof(UA_DataValue));
5531  UA_Variant_init(&dst->value);
5532  UA_StatusCode retval = Variant_copy(&src->value, &dst->value, NULL);
5533  if(retval != UA_STATUSCODE_GOOD)
5534  DataValue_deleteMembers(dst, NULL);
5535  return retval;
5536 }
5537 
5538 /* DiagnosticInfo */
5539 static void
5540 DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p, const UA_DataType *_) {
5541  String_deleteMembers(&p->additionalInfo, NULL);
5543  DiagnosticInfo_deleteMembers(p->innerDiagnosticInfo, NULL);
5545  }
5546 }
5547 
5548 static UA_StatusCode
5549 DiagnosticInfo_copy(UA_DiagnosticInfo const *src, UA_DiagnosticInfo *dst,
5550  const UA_DataType *_) {
5551  memcpy(dst, src, sizeof(UA_DiagnosticInfo));
5552  UA_String_init(&dst->additionalInfo);
5553  dst->innerDiagnosticInfo = NULL;
5555  if(src->hasAdditionalInfo)
5556  retval = UA_String_copy(&src->additionalInfo, &dst->additionalInfo);
5557  if(src->hasInnerDiagnosticInfo && src->innerDiagnosticInfo) {
5559  if(dst->innerDiagnosticInfo) {
5560  retval |= DiagnosticInfo_copy(src->innerDiagnosticInfo,
5561  dst->innerDiagnosticInfo, NULL);
5562  dst->hasInnerDiagnosticInfo = true;
5563  } else {
5564  dst->hasInnerDiagnosticInfo = false;
5565  retval |= UA_STATUSCODE_BADOUTOFMEMORY;
5566  }
5567  }
5568  return retval;
5569 }
5570 
5571 /********************/
5572 /* Structured Types */
5573 /********************/
5574 
5575 void *
5576 UA_new(const UA_DataType *type) {
5577  void *p = UA_calloc(1, type->memSize);
5578  return p;
5579 }
5580 
5581 static UA_StatusCode
5582 copyByte(const UA_Byte *src, UA_Byte *dst, const UA_DataType *_) {
5583  *dst = *src;
5584  return UA_STATUSCODE_GOOD;
5585 }
5586 
5587 static UA_StatusCode
5588 copy2Byte(const UA_UInt16 *src, UA_UInt16 *dst, const UA_DataType *_) {
5589  *dst = *src;
5590  return UA_STATUSCODE_GOOD;
5591 }
5592 
5593 static UA_StatusCode
5594 copy4Byte(const UA_UInt32 *src, UA_UInt32 *dst, const UA_DataType *_) {
5595  *dst = *src;
5596  return UA_STATUSCODE_GOOD;
5597 }
5598 
5599 static UA_StatusCode
5600 copy8Byte(const UA_UInt64 *src, UA_UInt64 *dst, const UA_DataType *_) {
5601  *dst = *src;
5602  return UA_STATUSCODE_GOOD;
5603 }
5604 
5605 static UA_StatusCode
5606 copyGuid(const UA_Guid *src, UA_Guid *dst, const UA_DataType *_) {
5607  *dst = *src;
5608  return UA_STATUSCODE_GOOD;
5609 }
5610 
5611 typedef UA_StatusCode
5612 (*UA_copySignature)(const void *src, void *dst, const UA_DataType *type);
5613 
5614 static const UA_copySignature copyJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
5615  (UA_copySignature)copyByte, // Boolean
5616  (UA_copySignature)copyByte, // SByte
5617  (UA_copySignature)copyByte, // Byte
5618  (UA_copySignature)copy2Byte, // Int16
5619  (UA_copySignature)copy2Byte, // UInt16
5620  (UA_copySignature)copy4Byte, // Int32
5621  (UA_copySignature)copy4Byte, // UInt32
5622  (UA_copySignature)copy8Byte, // Int64
5623  (UA_copySignature)copy8Byte, // UInt64
5624  (UA_copySignature)copy4Byte, // Float
5625  (UA_copySignature)copy8Byte, // Double
5626  (UA_copySignature)copy_noInit, // String
5627  (UA_copySignature)copy8Byte, // DateTime
5628  (UA_copySignature)copyGuid, // Guid
5629  (UA_copySignature)copy_noInit, // ByteString
5630  (UA_copySignature)copy_noInit, // XmlElement
5631  (UA_copySignature)NodeId_copy,
5632  (UA_copySignature)ExpandedNodeId_copy,
5633  (UA_copySignature)copy4Byte, // StatusCode
5634  (UA_copySignature)copy_noInit, // QualifiedName
5635  (UA_copySignature)LocalizedText_copy, // LocalizedText
5636  (UA_copySignature)ExtensionObject_copy,
5637  (UA_copySignature)DataValue_copy,
5638  (UA_copySignature)Variant_copy,
5639  (UA_copySignature)DiagnosticInfo_copy,
5640  (UA_copySignature)copy_noInit // all others
5641 };
5642 
5643 static UA_StatusCode
5644 copy_noInit(const void *src, void *dst, const UA_DataType *type) {
5646  uintptr_t ptrs = (uintptr_t)src;
5647  uintptr_t ptrd = (uintptr_t)dst;
5648  UA_Byte membersSize = type->membersSize;
5649  for(size_t i = 0; i < membersSize; ++i) {
5650  const UA_DataTypeMember *m= &type->members[i];
5651  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
5652  const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
5653  if(!m->isArray) {
5654  ptrs += m->padding;
5655  ptrd += m->padding;
5656  size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT;
5657  retval |= copyJumpTable[fi]((const void*)ptrs, (void*)ptrd, mt);
5658  ptrs += mt->memSize;
5659  ptrd += mt->memSize;
5660  } else {
5661  ptrs += m->padding;
5662  ptrd += m->padding;
5663  size_t *dst_size = (size_t*)ptrd;
5664  const size_t size = *((const size_t*)ptrs);
5665  ptrs += sizeof(size_t);
5666  ptrd += sizeof(size_t);
5667  retval |= UA_Array_copy(*(void* const*)ptrs, size, (void**)ptrd, mt);
5668  if(retval == UA_STATUSCODE_GOOD)
5669  *dst_size = size;
5670  else
5671  *dst_size = 0;
5672  ptrs += sizeof(void*);
5673  ptrd += sizeof(void*);
5674  }
5675  }
5676  return retval;
5677 }
5678 
5680 UA_copy(const void *src, void *dst, const UA_DataType *type) {
5681  memset(dst, 0, type->memSize); /* init */
5682  UA_StatusCode retval = copy_noInit(src, dst, type);
5683  if(retval != UA_STATUSCODE_GOOD)
5684  UA_deleteMembers(dst, type);
5685  return retval;
5686 }
5687 
5688 static void nopDeleteMembers(void *p, const UA_DataType *type) { }
5689 
5690 typedef void (*UA_deleteMembersSignature)(void *p, const UA_DataType *type);
5691 
5692 static const
5693 UA_deleteMembersSignature deleteMembersJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
5694  (UA_deleteMembersSignature)nopDeleteMembers, // Boolean
5695  (UA_deleteMembersSignature)nopDeleteMembers, // SByte
5696  (UA_deleteMembersSignature)nopDeleteMembers, // Byte
5697  (UA_deleteMembersSignature)nopDeleteMembers, // Int16
5698  (UA_deleteMembersSignature)nopDeleteMembers, // UInt16
5699  (UA_deleteMembersSignature)nopDeleteMembers, // Int32
5700  (UA_deleteMembersSignature)nopDeleteMembers, // UInt32
5701  (UA_deleteMembersSignature)nopDeleteMembers, // Int64
5702  (UA_deleteMembersSignature)nopDeleteMembers, // UInt64
5703  (UA_deleteMembersSignature)nopDeleteMembers, // Float
5704  (UA_deleteMembersSignature)nopDeleteMembers, // Double
5705  (UA_deleteMembersSignature)String_deleteMembers, // String
5706  (UA_deleteMembersSignature)nopDeleteMembers, // DateTime
5707  (UA_deleteMembersSignature)nopDeleteMembers, // Guid
5708  (UA_deleteMembersSignature)String_deleteMembers, // ByteString
5709  (UA_deleteMembersSignature)String_deleteMembers, // XmlElement
5710  (UA_deleteMembersSignature)NodeId_deleteMembers,
5711  (UA_deleteMembersSignature)ExpandedNodeId_deleteMembers, // ExpandedNodeId
5712  (UA_deleteMembersSignature)nopDeleteMembers, // StatusCode
5713  (UA_deleteMembersSignature)deleteMembers_noInit, // QualifiedName
5714  (UA_deleteMembersSignature)LocalizedText_deleteMembers, // LocalizedText
5715  (UA_deleteMembersSignature)ExtensionObject_deleteMembers,
5716  (UA_deleteMembersSignature)DataValue_deleteMembers,
5717  (UA_deleteMembersSignature)Variant_deletemembers,
5718  (UA_deleteMembersSignature)DiagnosticInfo_deleteMembers,
5719  (UA_deleteMembersSignature)deleteMembers_noInit,
5720 };
5721 
5722 static void
5723 deleteMembers_noInit(void *p, const UA_DataType *type) {
5724  uintptr_t ptr = (uintptr_t)p;
5725  UA_Byte membersSize = type->membersSize;
5726  for(size_t i = 0; i < membersSize; ++i) {
5727  const UA_DataTypeMember *m= &type->members[i];
5728  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
5729  const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
5730  if(!m->isArray) {
5731  ptr += m->padding;
5732  size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT;
5733  deleteMembersJumpTable[fi]((void*)ptr, mt);
5734  ptr += mt->memSize;
5735  } else {
5736  ptr += m->padding;
5737  size_t length = *(size_t*)ptr;
5738  ptr += sizeof(size_t);
5739  UA_Array_delete(*(void**)ptr, length, mt);
5740  ptr += sizeof(void*);
5741  }
5742  }
5743 }
5744 
5745 void
5746 UA_deleteMembers(void *p, const UA_DataType *type) {
5747  deleteMembers_noInit(p, type);
5748  memset(p, 0, type->memSize); /* init */
5749 }
5750 
5751 void
5752 UA_delete(void *p, const UA_DataType *type) {
5753  deleteMembers_noInit(p, type);
5754  UA_free(p);
5755 }
5756 
5757 /******************/
5758 /* Array Handling */
5759 /******************/
5760 
5761 void *
5762 UA_Array_new(size_t size, const UA_DataType *type) {
5763  if(size == 0)
5764  return UA_EMPTY_ARRAY_SENTINEL;
5765  return UA_calloc(size, type->memSize);
5766 }
5767 
5769 UA_Array_copy(const void *src, size_t size,
5770  void **dst, const UA_DataType *type) {
5771  if(size == 0) {
5772  if(src == NULL)
5773  *dst = NULL;
5774  else
5776  return UA_STATUSCODE_GOOD;
5777  }
5778 
5779  if(!type)
5781 
5782  /* calloc, so we don't have to check retval in every iteration of copying */
5783  *dst = UA_calloc(size, type->memSize);
5784  if(!*dst)
5786 
5787  if(type->fixedSize) {
5788  memcpy(*dst, src, type->memSize * size);
5789  return UA_STATUSCODE_GOOD;
5790  }
5791 
5792  uintptr_t ptrs = (uintptr_t)src;
5793  uintptr_t ptrd = (uintptr_t)*dst;
5795  for(size_t i = 0; i < size; ++i) {
5796  retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
5797  ptrs += type->memSize;
5798  ptrd += type->memSize;
5799  }
5800  if(retval != UA_STATUSCODE_GOOD) {
5801  UA_Array_delete(*dst, size, type);
5802  *dst = NULL;
5803  }
5804  return retval;
5805 }
5806 
5807 void
5808 UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
5809  if(!type->fixedSize) {
5810  uintptr_t ptr = (uintptr_t)p;
5811  for(size_t i = 0; i < size; ++i) {
5812  UA_deleteMembers((void*)ptr, type);
5813  ptr += type->memSize;
5814  }
5815  }
5816  UA_free((void*)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
5817 }
5818 
5819 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types_encoding_binary.c" ***********************************/
5820 
5821 /* This Source Code Form is subject to the terms of the Mozilla Public
5822  * License, v. 2.0. If a copy of the MPL was not distributed with this
5823  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5824 
5825 
5826 /* Type Encoding
5827  * -------------
5828  * This file contains encoding functions for the builtin data types and generic
5829  * functions that operate on all types and arrays. This requires the type
5830  * description from a UA_DataType structure. Note that some internal (static)
5831  * deocidng functions may abort and leave the type in an inconsistent state. But
5832  * this is always handled in UA_decodeBinary, where the error is caught and the
5833  * type cleaned up.
5834  *
5835  * Breaking a message into chunks is integrated with the encoding. When the end
5836  * of a buffer is reached, a callback is executed that sends the current buffer
5837  * as a chunk and exchanges the encoding buffer "underneath" the ongoing
5838  * encoding. This enables fast sending of large messages as spurious copying is
5839  * avoided. */
5840 
5841 #if defined(__clang__)
5842 # pragma GCC diagnostic push
5843 # pragma GCC diagnostic warning "-W#warnings"
5844 #endif
5845 
5846 #ifndef UA_BINARY_OVERLAYABLE_INTEGER
5847 # warning Integer endianness could not be detected to be little endian. Use slow generic encoding.
5848 #endif
5849 
5850 /* There is no robust way to detect float endianness in clang. This warning can be removed
5851  * if the target is known to be little endian with floats in the IEEE 754 format. */
5852 #ifndef UA_BINARY_OVERLAYABLE_FLOAT
5853 # warning Float endianness could not be detected to be little endian in the IEEE 754 format. Use slow generic encoding.
5854 #endif
5855 
5856 #if defined(__clang__)
5857 # pragma GCC diagnostic pop
5858 #endif
5859 
5860 /* Jumptables for de-/encoding and computing the buffer length. The methods in
5861  * the decoding jumptable do not all clean up their allocated memory when an
5862  * error occurs. So a final _deleteMembers needs to be called before returning
5863  * to the user. */
5864 typedef status (*UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type);
5866 
5867 typedef status (*UA_decodeBinarySignature)(void *UA_RESTRICT dst, const UA_DataType *type);
5869 
5870 typedef size_t (*UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype);
5872 
5873 /* Pointers to the current position and the last position in the buffer */
5874 static UA_THREAD_LOCAL u8 *g_pos;
5875 static UA_THREAD_LOCAL const u8 *g_end;
5876 static UA_THREAD_LOCAL UA_ByteString g_buf;
5877 
5878 /* In UA_encodeBinaryInternal, we store a pointer to the last "good" position in
5879  * the buffer. When encoding reaches the end of the buffer, send out a chunk
5880  * until that position, replace the buffer and retry encoding after the last
5881  * "checkpoint". The status code UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED is used
5882  * exclusively to indicate that the end of the buffer was reached.
5883  *
5884  * In order to prevent restoring to an old buffer position (where the buffer was
5885  * exchanged within a call from UA_encodeBinaryInternal and is no longer
5886  * valied), no methods must return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after
5887  * calling exchangeBuffer(). This needs to be ensured for the following methods:
5888  *
5889  * UA_encodeBinaryInternal
5890  * Array_encodeBinary
5891  * NodeId_encodeBinary
5892  * ExpandedNodeId_encodeBinary
5893  * LocalizedText_encodeBinary
5894  * ExtensionObject_encodeBinary
5895  * Variant_encodeBinary
5896  * DataValue_encodeBinary
5897  * DiagnosticInfo_encodeBinary */
5898 
5899 /* Thread-local buffers used for exchanging the buffer for chunking */
5900 static UA_THREAD_LOCAL UA_exchangeEncodeBuffer g_exchangeBufferCallback;
5901 static UA_THREAD_LOCAL void *g_exchangeBufferCallbackHandle;
5902 
5903 /* Send the current chunk and replace the buffer */
5904 static status
5905 exchangeBuffer(void) {
5906  if(!g_exchangeBufferCallback)
5908 
5909  /* Store context variables since exchangeBuffer might call UA_encode itself */
5910  UA_exchangeEncodeBuffer store_exchangeBufferCallback = g_exchangeBufferCallback;
5911  void *store_exchangeBufferCallbackHandle = g_exchangeBufferCallbackHandle;
5912  UA_ByteString buf = g_buf;
5913  size_t offset = (uintptr_t)(g_pos - g_buf.data);
5914 
5915  status ret = g_exchangeBufferCallback(g_exchangeBufferCallbackHandle, &buf, offset);
5916 
5917  /* Restore context variables */
5918  g_exchangeBufferCallback = store_exchangeBufferCallback;
5919  g_exchangeBufferCallbackHandle = store_exchangeBufferCallbackHandle;
5920  g_buf = buf;
5921  g_pos = buf.data;
5922  g_end = &buf.data[buf.length];
5923  return ret;
5924 }
5925 
5926 /*****************/
5927 /* Integer Types */
5928 /*****************/
5929 
5930 #if !UA_BINARY_OVERLAYABLE_INTEGER
5931 
5932 /* These en/decoding functions are only used when the architecture isn't little-endian. */
5933 static void
5934 UA_encode16(const u16 v, u8 buf[2]) {
5935  buf[0] = (u8)v;
5936  buf[1] = (u8)(v >> 8);
5937 }
5938 
5939 static void
5940 UA_decode16(const u8 buf[2], u16 *v) {
5941  *v = (u16)((u16)buf[0] + (((u16)buf[1]) << 8));
5942 }
5943 
5944 static void
5945 UA_encode32(const u32 v, u8 buf[4]) {
5946  buf[0] = (u8)v;
5947  buf[1] = (u8)(v >> 8);
5948  buf[2] = (u8)(v >> 16);
5949  buf[3] = (u8)(v >> 24);
5950 }
5951 
5952 static void
5953 UA_decode32(const u8 buf[4], u32 *v) {
5954  *v = (u32)((u32)buf[0] +
5955  (((u32)buf[1]) << 8) +
5956  (((u32)buf[2]) << 16) +
5957  (((u32)buf[3]) << 24));
5958 }
5959 
5960 static void
5961 UA_encode64(const u64 v, u8 buf[8]) {
5962  buf[0] = (u8)v;
5963  buf[1] = (u8)(v >> 8);
5964  buf[2] = (u8)(v >> 16);
5965  buf[3] = (u8)(v >> 24);
5966  buf[4] = (u8)(v >> 32);
5967  buf[5] = (u8)(v >> 40);
5968  buf[6] = (u8)(v >> 48);
5969  buf[7] = (u8)(v >> 56);
5970 }
5971 
5972 static void
5973 UA_decode64(const u8 buf[8], u64 *v) {
5974  *v = (u64)((u64)buf[0] +
5975  (((u64)buf[1]) << 8) +
5976  (((u64)buf[2]) << 16) +
5977  (((u64)buf[3]) << 24) +
5978  (((u64)buf[4]) << 32) +
5979  (((u64)buf[5]) << 40) +
5980  (((u64)buf[6]) << 48) +
5981  (((u64)buf[7]) << 56));
5982 }
5983 
5984 #endif /* !UA_BINARY_OVERLAYABLE_INTEGER */
5985 
5986 /* Boolean */
5987 static status
5988 Boolean_encodeBinary(const bool *src, const UA_DataType *_) {
5989  if(g_pos + sizeof(bool) > g_end)
5991  *g_pos = *(const u8*)src;
5992  ++g_pos;
5993  return UA_STATUSCODE_GOOD;
5994 }
5995 
5996 static status
5997 Boolean_decodeBinary(bool *dst, const UA_DataType *_) {
5998  if(g_pos + sizeof(bool) > g_end)
6000  *dst = (*g_pos > 0) ? true : false;
6001  ++g_pos;
6002  return UA_STATUSCODE_GOOD;
6003 }
6004 
6005 /* Byte */
6006 static status
6007 Byte_encodeBinary(const u8 *src, const UA_DataType *_) {
6008  if(g_pos + sizeof(u8) > g_end)
6010  *g_pos = *(const u8*)src;
6011  ++g_pos;
6012  return UA_STATUSCODE_GOOD;
6013 }
6014 
6015 static status
6016 Byte_decodeBinary(u8 *dst, const UA_DataType *_) {
6017  if(g_pos + sizeof(u8) > g_end)
6019  *dst = *g_pos;
6020  ++g_pos;
6021  return UA_STATUSCODE_GOOD;
6022 }
6023 
6024 /* UInt16 */
6025 static status
6026 UInt16_encodeBinary(u16 const *src, const UA_DataType *_) {
6027  if(g_pos + sizeof(u16) > g_end)
6029 #if UA_BINARY_OVERLAYABLE_INTEGER
6030  memcpy(g_pos, src, sizeof(u16));
6031 #else
6032  UA_encode16(*src, g_pos);
6033 #endif
6034  g_pos += 2;
6035  return UA_STATUSCODE_GOOD;
6036 }
6037 
6038 static status
6039 UInt16_decodeBinary(u16 *dst, const UA_DataType *_) {
6040  if(g_pos + sizeof(u16) > g_end)
6042 #if UA_BINARY_OVERLAYABLE_INTEGER
6043  memcpy(dst, g_pos, sizeof(u16));
6044 #else
6045  UA_decode16(g_pos, dst);
6046 #endif
6047  g_pos += 2;
6048  return UA_STATUSCODE_GOOD;
6049 }
6050 
6051 /* UInt32 */
6052 static status
6053 UInt32_encodeBinary(u32 const *src, const UA_DataType *_) {
6054  if(g_pos + sizeof(u32) > g_end)
6056 #if UA_BINARY_OVERLAYABLE_INTEGER
6057  memcpy(g_pos, src, sizeof(u32));
6058 #else
6059  UA_encode32(*src, g_pos);
6060 #endif
6061  g_pos += 4;
6062  return UA_STATUSCODE_GOOD;
6063 }
6064 
6065 static UA_INLINE status
6066 Int32_encodeBinary(i32 const *src) {
6067  return UInt32_encodeBinary((const u32*)src, NULL);
6068 }
6069 
6070 static status
6071 UInt32_decodeBinary(u32 *dst, const UA_DataType *_) {
6072  if(g_pos + sizeof(u32) > g_end)
6074 #if UA_BINARY_OVERLAYABLE_INTEGER
6075  memcpy(dst, g_pos, sizeof(u32));
6076 #else
6077  UA_decode32(g_pos, dst);
6078 #endif
6079  g_pos += 4;
6080  return UA_STATUSCODE_GOOD;
6081 }
6082 
6083 static UA_INLINE status
6084 Int32_decodeBinary(i32 *dst) {
6085  return UInt32_decodeBinary((u32*)dst, NULL);
6086 }
6087 
6088 static UA_INLINE status
6089 StatusCode_decodeBinary(status *dst) {
6090  return UInt32_decodeBinary((u32*)dst, NULL);
6091 }
6092 
6093 /* UInt64 */
6094 static status
6095 UInt64_encodeBinary(u64 const *src, const UA_DataType *_) {
6096  if(g_pos + sizeof(u64) > g_end)
6098 #if UA_BINARY_OVERLAYABLE_INTEGER
6099  memcpy(g_pos, src, sizeof(u64));
6100 #else
6101  UA_encode64(*src, g_pos);
6102 #endif
6103  g_pos += 8;
6104  return UA_STATUSCODE_GOOD;
6105 }
6106 
6107 static status
6108 UInt64_decodeBinary(u64 *dst, const UA_DataType *_) {
6109  if(g_pos + sizeof(u64) > g_end)
6111 #if UA_BINARY_OVERLAYABLE_INTEGER
6112  memcpy(dst, g_pos, sizeof(u64));
6113 #else
6114  UA_decode64(g_pos, dst);
6115 #endif
6116  g_pos += 8;
6117  return UA_STATUSCODE_GOOD;
6118 }
6119 
6120 static UA_INLINE status
6121 DateTime_decodeBinary(UA_DateTime *dst) {
6122  return UInt64_decodeBinary((u64*)dst, NULL);
6123 }
6124 
6125 /************************/
6126 /* Floating Point Types */
6127 /************************/
6128 
6129 #if UA_BINARY_OVERLAYABLE_FLOAT
6130 # define Float_encodeBinary UInt32_encodeBinary
6131 # define Float_decodeBinary UInt32_decodeBinary
6132 # define Double_encodeBinary UInt64_encodeBinary
6133 # define Double_decodeBinary UInt64_decodeBinary
6134 #else
6135 
6136 #include <math.h>
6137 
6138 /* Handling of IEEE754 floating point values was taken from Beej's Guide to
6139  * Network Programming (http://beej.us/guide/bgnet/) and enhanced to cover the
6140  * edge cases +/-0, +/-inf and nan. */
6141 static uint64_t
6142 pack754(long double f, unsigned bits, unsigned expbits) {
6143  unsigned significandbits = bits - expbits - 1;
6144  long double fnorm;
6145  long long sign;
6146  if (f < 0) { sign = 1; fnorm = -f; }
6147  else { sign = 0; fnorm = f; }
6148  int shift = 0;
6149  while(fnorm >= 2.0) { fnorm /= 2.0; ++shift; }
6150  while(fnorm < 1.0) { fnorm *= 2.0; --shift; }
6151  fnorm = fnorm - 1.0;
6152  long long significand = (long long)(fnorm * ((float)(1LL<<significandbits) + 0.5f));
6153  long long exponent = shift + ((1<<(expbits-1)) - 1);
6154  return (uint64_t)((sign<<(bits-1)) | (exponent<<(bits-expbits-1)) | significand);
6155 }
6156 
6157 static long double
6158 unpack754(uint64_t i, unsigned bits, unsigned expbits) {
6159  unsigned significandbits = bits - expbits - 1;
6160  long double result = (long double)(i&(uint64_t)((1LL<<significandbits)-1));
6161  result /= (1LL<<significandbits);
6162  result += 1.0f;
6163  unsigned bias = (unsigned)(1<<(expbits-1)) - 1;
6164  long long shift = (long long)((i>>significandbits) & (uint64_t)((1LL<<expbits)-1)) - bias;
6165  while(shift > 0) { result *= 2.0; --shift; }
6166  while(shift < 0) { result /= 2.0; ++shift; }
6167  result *= ((i>>(bits-1))&1)? -1.0: 1.0;
6168  return result;
6169 }
6170 
6171 /* Float */
6172 #define FLOAT_NAN 0xffc00000
6173 #define FLOAT_INF 0x7f800000
6174 #define FLOAT_NEG_INF 0xff800000
6175 #define FLOAT_NEG_ZERO 0x80000000
6176 
6177 static status
6178 Float_encodeBinary(UA_Float const *src, const UA_DataType *_) {
6179  UA_Float f = *src;
6180  u32 encoded;
6181  //cppcheck-suppress duplicateExpression
6182  if(f != f) encoded = FLOAT_NAN;
6183  else if(f == 0.0f) encoded = signbit(f) ? FLOAT_NEG_ZERO : 0;
6184  //cppcheck-suppress duplicateExpression
6185  else if(f/f != f/f) encoded = f > 0 ? FLOAT_INF : FLOAT_NEG_INF;
6186  else encoded = (u32)pack754(f, 32, 8);
6187  return UInt32_encodeBinary(&encoded, NULL);
6188 }
6189 
6190 static status
6191 Float_decodeBinary(UA_Float *dst, const UA_DataType *_) {
6192  u32 decoded;
6193  status ret = UInt32_decodeBinary(&decoded, NULL);
6194  if(ret != UA_STATUSCODE_GOOD)
6195  return ret;
6196  if(decoded == 0) *dst = 0.0f;
6197  else if(decoded == FLOAT_NEG_ZERO) *dst = -0.0f;
6198  else if(decoded == FLOAT_INF) *dst = INFINITY;
6199  else if(decoded == FLOAT_NEG_INF) *dst = -INFINITY;
6200  else if((decoded >= 0x7f800001 && decoded <= 0x7fffffff) ||
6201  (decoded >= 0xff800001 && decoded <= 0xffffffff)) *dst = NAN;
6202  else *dst = (UA_Float)unpack754(decoded, 32, 8);
6203  return UA_STATUSCODE_GOOD;
6204 }
6205 
6206 /* Double */
6207 #define DOUBLE_NAN 0xfff8000000000000L
6208 #define DOUBLE_INF 0x7ff0000000000000L
6209 #define DOUBLE_NEG_INF 0xfff0000000000000L
6210 #define DOUBLE_NEG_ZERO 0x8000000000000000L
6211 
6212 static status
6213 Double_encodeBinary(UA_Double const *src, const UA_DataType *_) {
6214  UA_Double d = *src;
6215  u64 encoded;
6216  //cppcheck-suppress duplicateExpression
6217  if(d != d) encoded = DOUBLE_NAN;
6218  else if(d == 0.0) encoded = signbit(d) ? DOUBLE_NEG_ZERO : 0;
6219  //cppcheck-suppress duplicateExpression
6220  else if(d/d != d/d) encoded = d > 0 ? DOUBLE_INF : DOUBLE_NEG_INF;
6221  else encoded = pack754(d, 64, 11);
6222  return UInt64_encodeBinary(&encoded, NULL);
6223 }
6224 
6225 static status
6226 Double_decodeBinary(UA_Double *dst, const UA_DataType *_) {
6227  u64 decoded;
6228  status ret = UInt64_decodeBinary(&decoded, NULL);
6229  if(ret != UA_STATUSCODE_GOOD)
6230  return ret;
6231  if(decoded == 0) *dst = 0.0;
6232  else if(decoded == DOUBLE_NEG_ZERO) *dst = -0.0;
6233  else if(decoded == DOUBLE_INF) *dst = INFINITY;
6234  else if(decoded == DOUBLE_NEG_INF) *dst = -INFINITY;
6235  //cppcheck-suppress redundantCondition
6236  else if((decoded >= 0x7ff0000000000001L && decoded <= 0x7fffffffffffffffL) ||
6237  (decoded >= 0xfff0000000000001L && decoded <= 0xffffffffffffffffL)) *dst = NAN;
6238  else *dst = (UA_Double)unpack754(decoded, 64, 11);
6239  return UA_STATUSCODE_GOOD;
6240 }
6241 
6242 #endif
6243 
6244 /* If encoding fails, exchange the buffer and try again. It is assumed that
6245  * encoding of numerical types never fails on a fresh buffer. */
6246 static status
6247 encodeNumericWithExchangeBuffer(const void *ptr,
6248  UA_encodeBinarySignature encodeFunc) {
6249  status ret = encodeFunc(ptr, NULL);
6251  ret = exchangeBuffer();
6252  if(ret != UA_STATUSCODE_GOOD)
6253  return ret;
6254  encodeFunc(ptr, NULL);
6255  }
6256  return UA_STATUSCODE_GOOD;
6257 }
6258 
6259 /* If the type is more complex, wrap encoding into the following method to
6260  * ensure that the buffer is exchanged with intermediate checkpoints. */
6261 static status
6262 UA_encodeBinaryInternal(const void *src, const UA_DataType *type);
6263 
6264 /******************/
6265 /* Array Handling */
6266 /******************/
6267 
6268 static status
6269 Array_encodeBinaryOverlayable(uintptr_t ptr, size_t length, size_t elementMemSize) {
6270  /* Store the number of already encoded elements */
6271  size_t finished = 0;
6272 
6273  /* Loop as long as more elements remain than fit into the chunk */
6274  while(g_end < g_pos + (elementMemSize * (length-finished))) {
6275  size_t possible = ((uintptr_t)g_end - (uintptr_t)g_pos) / (sizeof(u8) * elementMemSize);
6276  size_t possibleMem = possible * elementMemSize;
6277  memcpy(g_pos, (void*)ptr, possibleMem);
6278  g_pos += possibleMem;
6279  ptr += possibleMem;
6280  finished += possible;
6281  status ret = exchangeBuffer();
6282  if(ret != UA_STATUSCODE_GOOD)
6283  return ret;
6284  }
6285 
6286  /* Encode the remaining elements */
6287  memcpy(g_pos, (void*)ptr, elementMemSize * (length-finished));
6288  g_pos += elementMemSize * (length-finished);
6289  return UA_STATUSCODE_GOOD;
6290 }
6291 
6292 static status
6293 Array_encodeBinaryComplex(uintptr_t ptr, size_t length, const UA_DataType *type) {
6294  /* Get the encoding function for the data type. The jumptable at
6295  * UA_BUILTIN_TYPES_COUNT points to the generic UA_encodeBinary method */
6296  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6297  UA_encodeBinarySignature encodeType = encodeBinaryJumpTable[encode_index];
6298 
6299  /* Encode every element */
6300  for(size_t i = 0; i < length; ++i) {
6301  u8 *oldpos = g_pos;
6302  status ret = encodeType((const void*)ptr, type);
6303  ptr += type->memSize;
6304  /* Encoding failed, switch to the next chunk when possible */
6305  if(ret != UA_STATUSCODE_GOOD) {
6307  g_pos = oldpos; /* Set buffer position to the end of the last encoded element */
6308  ret = exchangeBuffer();
6309  ptr -= type->memSize; /* Undo to retry encoding the ith element */
6310  --i;
6311  }
6313  if(ret != UA_STATUSCODE_GOOD)
6314  return ret; /* Unrecoverable fail */
6315  }
6316  }
6317  return UA_STATUSCODE_GOOD;
6318 }
6319 
6320 static status
6321 Array_encodeBinary(const void *src, size_t length, const UA_DataType *type) {
6322  /* Check and convert the array length to int32 */
6323  i32 signed_length = -1;
6324  if(length > UA_INT32_MAX)
6326  if(length > 0)
6327  signed_length = (i32)length;
6328  else if(src == UA_EMPTY_ARRAY_SENTINEL)
6329  signed_length = 0;
6330 
6331  /* Encode the array length */
6332  status ret = encodeNumericWithExchangeBuffer(&signed_length,
6333  (UA_encodeBinarySignature)UInt32_encodeBinary);
6334 
6335  /* Quit early? */
6336  if(ret != UA_STATUSCODE_GOOD || length == 0)
6337  return ret;
6338 
6339  /* Encode the content */
6340  if(!type->overlayable)
6341  return Array_encodeBinaryComplex((uintptr_t)src, length, type);
6342  return Array_encodeBinaryOverlayable((uintptr_t)src, length, type->memSize);
6343 }
6344 
6345 static status
6346 Array_decodeBinary(void *UA_RESTRICT *UA_RESTRICT dst,
6347  size_t *out_length, const UA_DataType *type) {
6348  /* Decode the length */
6349  i32 signed_length;
6350  status ret = Int32_decodeBinary(&signed_length);
6351  if(ret != UA_STATUSCODE_GOOD)
6352  return ret;
6353 
6354  /* Return early for empty arrays */
6355  if(signed_length <= 0) {
6356  *out_length = 0;
6357  if(signed_length < 0)
6358  *dst = NULL;
6359  else
6360  *dst = UA_EMPTY_ARRAY_SENTINEL;
6361  return UA_STATUSCODE_GOOD;
6362  }
6363 
6364  /* Filter out arrays that can obviously not be decoded, because the message
6365  * is too small for the array length. This prevents the allocation of very
6366  * long arrays for bogus messages.*/
6367  size_t length = (size_t)signed_length;
6368  if(g_pos + ((type->memSize * length) / 32) > g_end)
6370 
6371  /* Allocate memory */
6372  *dst = UA_calloc(length, type->memSize);
6373  if(!*dst)
6375 
6376  if(type->overlayable) {
6377  /* memcpy overlayable array */
6378  if(g_end < g_pos + (type->memSize * length)) {
6379  UA_free(*dst);
6380  *dst = NULL;
6382  }
6383  memcpy(*dst, g_pos, type->memSize * length);
6384  g_pos += type->memSize * length;
6385  } else {
6386  /* Decode array members */
6387  uintptr_t ptr = (uintptr_t)*dst;
6388  size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6389  for(size_t i = 0; i < length; ++i) {
6390  ret = decodeBinaryJumpTable[decode_index]((void*)ptr, type);
6391  if(ret != UA_STATUSCODE_GOOD) {
6392  // +1 because last element is also already initialized
6393  UA_Array_delete(*dst, i+1, type);
6394  *dst = NULL;
6395  return ret;
6396  }
6397  ptr += type->memSize;
6398  }
6399  }
6400  *out_length = length;
6401  return UA_STATUSCODE_GOOD;
6402 }
6403 
6404 /*****************/
6405 /* Builtin Types */
6406 /*****************/
6407 
6408 static status
6409 String_encodeBinary(UA_String const *src, const UA_DataType *_) {
6410  return Array_encodeBinary(src->data, src->length, &UA_TYPES[UA_TYPES_BYTE]);
6411 }
6412 
6413 static status
6414 String_decodeBinary(UA_String *dst, const UA_DataType *_) {
6415  return Array_decodeBinary((void**)&dst->data, &dst->length, &UA_TYPES[UA_TYPES_BYTE]);
6416 }
6417 
6418 static UA_INLINE status
6419 ByteString_encodeBinary(UA_ByteString const *src) {
6420  return String_encodeBinary((const UA_String*)src, NULL);
6421 }
6422 
6423 static UA_INLINE status
6424 ByteString_decodeBinary(UA_ByteString *dst) {
6425  return String_decodeBinary((UA_ByteString*)dst, NULL);
6426 }
6427 
6428 /* Guid */
6429 static status
6430 Guid_encodeBinary(UA_Guid const *src, const UA_DataType *_) {
6431  status ret = UInt32_encodeBinary(&src->data1, NULL);
6432  ret |= UInt16_encodeBinary(&src->data2, NULL);
6433  ret |= UInt16_encodeBinary(&src->data3, NULL);
6434  if(g_pos + (8*sizeof(u8)) > g_end)
6436  memcpy(g_pos, src->data4, 8*sizeof(u8));
6437  g_pos += 8;
6438  return ret;
6439 }
6440 
6441 static status
6442 Guid_decodeBinary(UA_Guid *dst, const UA_DataType *_) {
6443  status ret = UInt32_decodeBinary(&dst->data1, NULL);
6444  ret |= UInt16_decodeBinary(&dst->data2, NULL);
6445  ret |= UInt16_decodeBinary(&dst->data3, NULL);
6446  if(g_pos + (8*sizeof(u8)) > g_end)
6448  memcpy(dst->data4, g_pos, 8*sizeof(u8));
6449  g_pos += 8;
6450  return ret;
6451 }
6452 
6453 /* NodeId */
6454 #define UA_NODEIDTYPE_NUMERIC_TWOBYTE 0
6455 #define UA_NODEIDTYPE_NUMERIC_FOURBYTE 1
6456 #define UA_NODEIDTYPE_NUMERIC_COMPLETE 2
6457 
6458 #define UA_EXPANDEDNODEID_SERVERINDEX_FLAG 0x40
6459 #define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG 0x80
6460 
6461 /* For ExpandedNodeId, we prefill the encoding mask. We can return
6462  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED before encoding the string, as the
6463  * buffer is not replaced. */
6464 static status
6465 NodeId_encodeBinaryWithEncodingMask(UA_NodeId const *src, u8 encoding) {
6466  status ret = UA_STATUSCODE_GOOD;
6467  switch(src->identifierType) {
6468  case UA_NODEIDTYPE_NUMERIC:
6470  encoding |= UA_NODEIDTYPE_NUMERIC_COMPLETE;
6471  ret |= Byte_encodeBinary(&encoding, NULL);
6472  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6473  ret |= UInt32_encodeBinary(&src->identifier.numeric, NULL);
6474  } else if(src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) {
6475  encoding |= UA_NODEIDTYPE_NUMERIC_FOURBYTE;
6476  ret |= Byte_encodeBinary(&encoding, NULL);
6477  u8 nsindex = (u8)src->namespaceIndex;
6478  ret |= Byte_encodeBinary(&nsindex, NULL);
6479  u16 identifier16 = (u16)src->identifier.numeric;
6480  ret |= UInt16_encodeBinary(&identifier16, NULL);
6481  } else {
6482  encoding |= UA_NODEIDTYPE_NUMERIC_TWOBYTE;
6483  ret |= Byte_encodeBinary(&encoding, NULL);
6484  u8 identifier8 = (u8)src->identifier.numeric;
6485  ret |= Byte_encodeBinary(&identifier8, NULL);
6486  }
6487  break;
6488  case UA_NODEIDTYPE_STRING:
6489  encoding |= UA_NODEIDTYPE_STRING;
6490  ret |= Byte_encodeBinary(&encoding, NULL);
6491  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6492  if(ret != UA_STATUSCODE_GOOD)
6493  return ret;
6494  ret = String_encodeBinary(&src->identifier.string, NULL);
6495  break;
6496  case UA_NODEIDTYPE_GUID:
6497  encoding |= UA_NODEIDTYPE_GUID;
6498  ret |= Byte_encodeBinary(&encoding, NULL);
6499  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6500  ret |= Guid_encodeBinary(&src->identifier.guid, NULL);
6501  break;
6503  encoding |= UA_NODEIDTYPE_BYTESTRING;
6504  ret |= Byte_encodeBinary(&encoding, NULL);
6505  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6506  if(ret != UA_STATUSCODE_GOOD)
6507  return ret;
6508  ret = ByteString_encodeBinary(&src->identifier.byteString);
6509  break;
6510  default:
6512  }
6513  return ret;
6514 }
6515 
6516 static status
6517 NodeId_encodeBinary(UA_NodeId const *src, const UA_DataType *_) {
6518  return NodeId_encodeBinaryWithEncodingMask(src, 0);
6519 }
6520 
6521 static status
6522 NodeId_decodeBinary(UA_NodeId *dst, const UA_DataType *_) {
6523  u8 dstByte = 0, encodingByte = 0;
6524  u16 dstUInt16 = 0;
6525 
6526  /* Decode the encoding bitfield */
6527  status ret = Byte_decodeBinary(&encodingByte, NULL);
6528  if(ret != UA_STATUSCODE_GOOD)
6529  return ret;
6530 
6531  /* Filter out the bits used only for ExpandedNodeIds */
6532  encodingByte &= (u8)~(UA_EXPANDEDNODEID_SERVERINDEX_FLAG |
6534 
6535  /* Decode the namespace and identifier */
6536  switch (encodingByte) {
6539  ret = Byte_decodeBinary(&dstByte, NULL);
6540  dst->identifier.numeric = dstByte;
6541  dst->namespaceIndex = 0;
6542  break;
6545  ret |= Byte_decodeBinary(&dstByte, NULL);
6546  dst->namespaceIndex = dstByte;
6547  ret |= UInt16_decodeBinary(&dstUInt16, NULL);
6548  dst->identifier.numeric = dstUInt16;
6549  break;
6552  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6553  ret |= UInt32_decodeBinary(&dst->identifier.numeric, NULL);
6554  break;
6555  case UA_NODEIDTYPE_STRING:
6557  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6558  ret |= String_decodeBinary(&dst->identifier.string, NULL);
6559  break;
6560  case UA_NODEIDTYPE_GUID:
6562  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6563  ret |= Guid_decodeBinary(&dst->identifier.guid, NULL);
6564  break;
6567  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6568  ret |= ByteString_decodeBinary(&dst->identifier.byteString);
6569  break;
6570  default:
6572  break;
6573  }
6574  return ret;
6575 }
6576 
6577 /* ExpandedNodeId */
6578 static status
6579 ExpandedNodeId_encodeBinary(UA_ExpandedNodeId const *src, const UA_DataType *_) {
6580  /* Set up the encoding mask */
6581  u8 encoding = 0;
6582  if((void*)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL)
6584  if(src->serverIndex > 0)
6586 
6587  /* Encode the NodeId */
6588  status ret = NodeId_encodeBinaryWithEncodingMask(&src->nodeId, encoding);
6589  if(ret != UA_STATUSCODE_GOOD)
6590  return ret;
6591 
6592  /* Encode the namespace. Do not return
6593  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED afterwards. */
6594  if((void*)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL) {
6595  ret = String_encodeBinary(&src->namespaceUri, NULL);
6597  if(ret != UA_STATUSCODE_GOOD)
6598  return ret;
6599  }
6600 
6601  /* Encode the serverIndex */
6602  if(src->serverIndex > 0)
6603  ret = encodeNumericWithExchangeBuffer(&src->serverIndex,
6604  (UA_encodeBinarySignature)UInt32_encodeBinary);
6606  return ret;
6607 }
6608 
6609 static status
6610 ExpandedNodeId_decodeBinary(UA_ExpandedNodeId *dst, const UA_DataType *_) {
6611  /* Decode the encoding mask */
6612  if(g_pos >= g_end)
6614  u8 encoding = *g_pos;
6615 
6616  /* Decode the NodeId */
6617  status ret = NodeId_decodeBinary(&dst->nodeId, NULL);
6618 
6619  /* Decode the NamespaceUri */
6620  if(encoding & UA_EXPANDEDNODEID_NAMESPACEURI_FLAG) {
6621  dst->nodeId.namespaceIndex = 0;
6622  ret |= String_decodeBinary(&dst->namespaceUri, NULL);
6623  }
6624 
6625  /* Decode the ServerIndex */
6626  if(encoding & UA_EXPANDEDNODEID_SERVERINDEX_FLAG)
6627  ret |= UInt32_decodeBinary(&dst->serverIndex, NULL);
6628  return ret;
6629 }
6630 
6631 /* LocalizedText */
6632 #define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE 0x01
6633 #define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT 0x02
6634 
6635 static status
6636 LocalizedText_encodeBinary(UA_LocalizedText const *src, const UA_DataType *_) {
6637  /* Set up the encoding mask */
6638  u8 encoding = 0;
6639  if(src->locale.data)
6641  if(src->text.data)
6643 
6644  /* Encode the encoding byte */
6645  status ret = Byte_encodeBinary(&encoding, NULL);
6646  if(ret != UA_STATUSCODE_GOOD)
6647  return ret;
6648 
6649  /* Encode the strings */
6651  ret |= String_encodeBinary(&src->locale, NULL);
6653  ret |= String_encodeBinary(&src->text, NULL);
6655  return ret;
6656 }
6657 
6658 static status
6659 LocalizedText_decodeBinary(UA_LocalizedText *dst, const UA_DataType *_) {
6660  /* Decode the encoding mask */
6661  u8 encoding = 0;
6662  status ret = Byte_decodeBinary(&encoding, NULL);
6663 
6664  /* Decode the content */
6666  ret |= String_decodeBinary(&dst->locale, NULL);
6668  ret |= String_decodeBinary(&dst->text, NULL);
6669  return ret;
6670 }
6671 
6672 /* The binary encoding has a different nodeid from the data type. So it is not
6673  * possible to reuse UA_findDataType */
6674 static const UA_DataType *
6675 UA_findDataTypeByBinary(const UA_NodeId *typeId) {
6676  /* We only store a numeric identifier for the encoding nodeid of data types */
6677  if(typeId->identifierType != UA_NODEIDTYPE_NUMERIC)
6678  return NULL;
6679 
6680  /* Iterate over the array */
6681  for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
6682  if(UA_TYPES[i].binaryEncodingId == typeId->identifier.numeric &&
6684  return &UA_TYPES[i];
6685  }
6686  return NULL;
6687 }
6688 
6689 /* ExtensionObject */
6690 static status
6691 ExtensionObject_encodeBinary(UA_ExtensionObject const *src, const UA_DataType *_) {
6692  u8 encoding = src->encoding;
6693 
6694  /* No content or already encoded content. Do not return
6695  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after encoding the NodeId. */
6696  if(encoding <= UA_EXTENSIONOBJECT_ENCODED_XML) {
6697  status ret = NodeId_encodeBinary(&src->content.encoded.typeId, NULL);
6698  if(ret != UA_STATUSCODE_GOOD)
6699  return ret;
6700  ret = encodeNumericWithExchangeBuffer(&encoding,
6701  (UA_encodeBinarySignature)Byte_encodeBinary);
6702  if(ret != UA_STATUSCODE_GOOD)
6703  return ret;
6704  switch (src->encoding) {
6706  break;
6709  ret = ByteString_encodeBinary(&src->content.encoded.body);
6710  break;
6711  default:
6713  }
6714  return ret;
6715  }
6716 
6717  /* Cannot encode with no data or no type description */
6718  if(!src->content.decoded.type || !src->content.decoded.data)
6720 
6721  /* Write the NodeId for the binary encoded type. The NodeId is always
6722  * numeric, so no buffer replacement is taking place. */
6723  UA_NodeId typeId = src->content.decoded.type->typeId;
6726  typeId.identifier.numeric = src->content.decoded.type->binaryEncodingId;
6727  status ret = NodeId_encodeBinary(&typeId, NULL);
6728 
6729  /* Write the encoding byte */
6731  ret |= Byte_encodeBinary(&encoding, NULL);
6732 
6733  /* Compute the content length */
6734  const UA_DataType *type = src->content.decoded.type;
6735  size_t len = UA_calcSizeBinary(src->content.decoded.data, type);
6736 
6737  /* Encode the content length */
6738  if(len > UA_INT32_MAX)
6740  i32 signed_len = (i32)len;
6741  ret |= Int32_encodeBinary(&signed_len);
6742 
6743  /* Return early upon failures (no buffer exchange until here) */
6744  if(ret != UA_STATUSCODE_GOOD)
6745  return ret;
6746 
6747  /* Encode the content */
6748  return UA_encodeBinaryInternal(src->content.decoded.data, type);
6749 }
6750 
6751 static status
6752 ExtensionObject_decodeBinaryContent(UA_ExtensionObject *dst, const UA_NodeId *typeId) {
6753  /* Lookup the datatype */
6754  const UA_DataType *type = UA_findDataTypeByBinary(typeId);
6755 
6756  /* Unknown type, just take the binary content */
6757  if(!type) {
6759  UA_NodeId_copy(typeId, &dst->content.encoded.typeId);
6760  return ByteString_decodeBinary(&dst->content.encoded.body);
6761  }
6762 
6763  /* Allocate memory */
6764  dst->content.decoded.data = UA_new(type);
6765  if(!dst->content.decoded.data)
6767 
6768  /* Jump over the length field (TODO: check if the decoded length matches) */
6769  g_pos += 4;
6770 
6771  /* Decode */
6773  dst->content.decoded.type = type;
6774  size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6775  return decodeBinaryJumpTable[decode_index](dst->content.decoded.data, type);
6776 }
6777 
6778 static status
6779 ExtensionObject_decodeBinary(UA_ExtensionObject *dst, const UA_DataType *_) {
6780  u8 encoding = 0;
6781  UA_NodeId binTypeId; /* Can contain a string nodeid. But no corresponding
6782  * type is then found in open62541. We only store
6783  * numerical nodeids of the binary encoding identifier.
6784  * The extenionobject will be decoded to contain a
6785  * binary blob. */
6786  UA_NodeId_init(&binTypeId);
6787  status ret = NodeId_decodeBinary(&binTypeId, NULL);
6788  ret |= Byte_decodeBinary(&encoding, NULL);
6789  if(ret != UA_STATUSCODE_GOOD) {
6790  UA_NodeId_deleteMembers(&binTypeId);
6791  return ret;
6792  }
6793 
6794  if(encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
6795  ret = ExtensionObject_decodeBinaryContent(dst, &binTypeId);
6796  UA_NodeId_deleteMembers(&binTypeId);
6797  } else if(encoding == UA_EXTENSIONOBJECT_ENCODED_NOBODY) {
6798  dst->encoding = (UA_ExtensionObjectEncoding)encoding;
6799  dst->content.encoded.typeId = binTypeId; /* move to dst */
6800  dst->content.encoded.body = UA_BYTESTRING_NULL;
6801  } else if(encoding == UA_EXTENSIONOBJECT_ENCODED_XML) {
6802  dst->encoding = (UA_ExtensionObjectEncoding)encoding;
6803  dst->content.encoded.typeId = binTypeId; /* move to dst */
6804  ret = ByteString_decodeBinary(&dst->content.encoded.body);
6805  if(ret != UA_STATUSCODE_GOOD)
6806  UA_NodeId_deleteMembers(&dst->content.encoded.typeId);
6807  } else {
6808  UA_NodeId_deleteMembers(&binTypeId);
6810  }
6811 
6812  return ret;
6813 }
6814 
6815 /* Variant */
6816 
6817 /* Never returns UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED */
6818 static status
6819 Variant_encodeBinaryWrapExtensionObject(const UA_Variant *src, const bool isArray) {
6820  /* Default to 1 for a scalar. */
6821  size_t length = 1;
6822 
6823  /* Encode the array length if required */
6824  status ret = UA_STATUSCODE_GOOD;
6825  if(isArray) {
6826  if(src->arrayLength > UA_INT32_MAX)
6828  length = src->arrayLength;
6829  i32 encodedLength = (i32)src->arrayLength;
6830  ret = Int32_encodeBinary(&encodedLength);
6831  if(ret != UA_STATUSCODE_GOOD)
6832  return ret;
6833  }
6834 
6835  /* Set up the ExtensionObject */
6836  UA_ExtensionObject eo;
6837  UA_ExtensionObject_init(&eo);
6839  eo.content.decoded.type = src->type;
6840  const u16 memSize = src->type->memSize;
6841  uintptr_t ptr = (uintptr_t)src->data;
6842 
6843  /* Iterate over the array */
6844  for(size_t i = 0; i < length && ret == UA_STATUSCODE_GOOD; ++i) {
6845  eo.content.decoded.data = (void*)ptr;
6846  ret = UA_encodeBinaryInternal(&eo, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);
6847  ptr += memSize;
6848  }
6849  return ret;
6850 }
6851 
6855  UA_VARIANT_ENCODINGMASKTYPE_ARRAY = (0x01 << 7) // bit 7
6856 };
6857 
6858 static status
6859 Variant_encodeBinary(const UA_Variant *src, const UA_DataType *_) {
6860  /* Quit early for the empty variant */
6861  u8 encoding = 0;
6862  if(!src->type)
6863  return Byte_encodeBinary(&encoding, NULL);
6864 
6865  /* Set the content type in the encoding mask */
6866  const bool isBuiltin = src->type->builtin;
6867  if(isBuiltin)
6868  encoding |= UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK & (u8)(src->type->typeIndex + 1);
6869  else
6871 
6872  /* Set the array type in the encoding mask */
6873  const bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
6874  const bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
6875  if(isArray) {
6877  if(hasDimensions)
6879  }
6880 
6881  /* Encode the encoding byte */
6882  status ret = Byte_encodeBinary(&encoding, NULL);
6883  if(ret != UA_STATUSCODE_GOOD)
6884  return ret;
6885 
6886  /* Encode the content */
6887  if(!isBuiltin)
6888  ret = Variant_encodeBinaryWrapExtensionObject(src, isArray);
6889  else if(!isArray)
6890  ret = UA_encodeBinaryInternal(src->data, src->type);
6891  else
6892  ret = Array_encodeBinary(src->data, src->arrayLength, src->type);
6893 
6894  /* Encode the array dimensions */
6895  if(hasDimensions && ret == UA_STATUSCODE_GOOD)
6896  ret = Array_encodeBinary(src->arrayDimensions, src->arrayDimensionsSize,
6898  return ret;
6899 }
6900 
6901 static status
6902 Variant_decodeBinaryUnwrapExtensionObject(UA_Variant *dst) {
6903  /* Save the position in the ByteString. If unwrapping is not possible, start
6904  * from here to decode a normal ExtensionObject. */
6905  u8 *old_pos = g_pos;
6906 
6907  /* Decode the DataType */
6908  UA_NodeId typeId;
6909  UA_NodeId_init(&typeId);
6910  status ret = NodeId_decodeBinary(&typeId, NULL);
6911  if(ret != UA_STATUSCODE_GOOD)
6912  return ret;
6913 
6914  /* Decode the EncodingByte */
6915  u8 encoding;
6916  ret = Byte_decodeBinary(&encoding, NULL);
6917  if(ret != UA_STATUSCODE_GOOD) {
6918  UA_NodeId_deleteMembers(&typeId);
6919  return ret;
6920  }
6921 
6922  /* Search for the datatype. Default to ExtensionObject. */
6923  if(encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING &&
6924  (dst->type = UA_findDataTypeByBinary(&typeId)) != NULL) {
6925  /* Jump over the length field (TODO: check if length matches) */
6926  g_pos += 4;
6927  } else {
6928  /* Reset and decode as ExtensionObject */
6930  g_pos = old_pos;
6931  UA_NodeId_deleteMembers(&typeId);
6932  }
6933 
6934  /* Allocate memory */
6935  dst->data = UA_new(dst->type);
6936  if(!dst->data)
6938 
6939  /* Decode the content */
6940  size_t decode_index = dst->type->builtin ? dst->type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6941  return decodeBinaryJumpTable[decode_index](dst->data, dst->type);
6942 }
6943 
6944 /* The resulting variant always has the storagetype UA_VARIANT_DATA. */
6945 static status
6946 Variant_decodeBinary(UA_Variant *dst, const UA_DataType *_) {
6947  /* Decode the encoding byte */
6948  u8 encodingByte;
6949  status ret = Byte_decodeBinary(&encodingByte, NULL);
6950  if(ret != UA_STATUSCODE_GOOD)
6951  return ret;
6952 
6953  /* Return early for an empty variant (was already _inited) */
6954  if(encodingByte == 0)
6955  return UA_STATUSCODE_GOOD;
6956 
6957  /* Does the variant contain an array? */
6958  const bool isArray = (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_ARRAY) > 0;
6959 
6960  /* Get the datatype of the content. The type must be a builtin data type.
6961  * All not-builtin types are wrapped in an ExtensionObject.
6962  * The content can not be a variant again, otherwise we may run into a stack overflow problem.
6963  * See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4233 */
6964  size_t typeIndex = (size_t)((encodingByte & UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK) - 1);
6965  if(typeIndex > UA_TYPES_DIAGNOSTICINFO || typeIndex == UA_TYPES_VARIANT)
6967  dst->type = &UA_TYPES[typeIndex];
6968 
6969  /* Decode the content */
6970  if(isArray) {
6971  ret = Array_decodeBinary(&dst->data, &dst->arrayLength, dst->type);
6972  } else if(typeIndex != UA_TYPES_EXTENSIONOBJECT) {
6973  dst->data = UA_new(dst->type);
6974  if(!dst->data)
6976  ret = decodeBinaryJumpTable[typeIndex](dst->data, dst->type);
6977  } else {
6978  ret = Variant_decodeBinaryUnwrapExtensionObject(dst);
6979  }
6980 
6981  /* Decode array dimensions */
6982  if(isArray && (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS) > 0)
6983  ret |= Array_decodeBinary((void**)&dst->arrayDimensions,
6985  return ret;
6986 }
6987 
6988 /* DataValue */
6989 static status
6990 DataValue_encodeBinary(UA_DataValue const *src, const UA_DataType *_) {
6991  /* Set up the encoding mask */
6992  u8 encodingMask = (u8)
6993  (((u8)src->hasValue) |
6994  ((u8)src->hasStatus << 1) |
6995  ((u8)src->hasSourceTimestamp << 2) |
6996  ((u8)src->hasServerTimestamp << 3) |
6997  ((u8)src->hasSourcePicoseconds << 4) |
6998  ((u8)src->hasServerPicoseconds << 5));
6999 
7000  /* Encode the encoding byte */
7001  status ret = Byte_encodeBinary(&encodingMask, NULL);
7002  if(ret != UA_STATUSCODE_GOOD)
7003  return ret;
7004 
7005  /* Encode the variant. Afterwards, do not return
7006  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as the buffer might have been
7007  * exchanged during encoding of the variant. */
7008  if(src->hasValue) {
7009  ret = Variant_encodeBinary(&src->value, NULL);
7010  if(ret != UA_STATUSCODE_GOOD)
7011  return ret;
7012  }
7013 
7014  if(src->hasStatus)
7015  ret |= encodeNumericWithExchangeBuffer(&src->status,
7016  (UA_encodeBinarySignature)UInt32_encodeBinary);
7017  if(src->hasSourceTimestamp)
7018  ret |= encodeNumericWithExchangeBuffer(&src->sourceTimestamp,
7019  (UA_encodeBinarySignature)UInt64_encodeBinary);
7020  if(src->hasSourcePicoseconds)
7021  ret |= encodeNumericWithExchangeBuffer(&src->sourcePicoseconds,
7022  (UA_encodeBinarySignature)UInt16_encodeBinary);
7023  if(src->hasServerTimestamp)
7024  ret |= encodeNumericWithExchangeBuffer(&src->serverTimestamp,
7025  (UA_encodeBinarySignature)UInt64_encodeBinary);
7026  if(src->hasServerPicoseconds)
7027  ret |= encodeNumericWithExchangeBuffer(&src->serverPicoseconds,
7028  (UA_encodeBinarySignature)UInt16_encodeBinary);
7030  return ret;
7031 }
7032 
7033 #define MAX_PICO_SECONDS 9999
7034 
7035 static status
7036 DataValue_decodeBinary(UA_DataValue *dst, const UA_DataType *_) {
7037  /* Decode the encoding mask */
7038  u8 encodingMask;
7039  status ret = Byte_decodeBinary(&encodingMask, NULL);
7040  if(ret != UA_STATUSCODE_GOOD)
7041  return ret;
7042 
7043  /* Decode the content */
7044  if(encodingMask & 0x01) {
7045  dst->hasValue = true;
7046  ret |= Variant_decodeBinary(&dst->value, NULL);
7047  }
7048  if(encodingMask & 0x02) {
7049  dst->hasStatus = true;
7050  ret |= StatusCode_decodeBinary(&dst->status);
7051  }
7052  if(encodingMask & 0x04) {
7053  dst->hasSourceTimestamp = true;
7054  ret |= DateTime_decodeBinary(&dst->sourceTimestamp);
7055  }
7056  if(encodingMask & 0x10) {
7057  dst->hasSourcePicoseconds = true;
7058  ret |= UInt16_decodeBinary(&dst->sourcePicoseconds, NULL);
7061  }
7062  if(encodingMask & 0x08) {
7063  dst->hasServerTimestamp = true;
7064  ret |= DateTime_decodeBinary(&dst->serverTimestamp);
7065  }
7066  if(encodingMask & 0x20) {
7067  dst->hasServerPicoseconds = true;
7068  ret |= UInt16_decodeBinary(&dst->serverPicoseconds, NULL);
7071  }
7072  return ret;
7073 }
7074 
7075 /* DiagnosticInfo */
7076 static status
7077 DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, const UA_DataType *_) {
7078  /* Set up the encoding mask */
7079  u8 encodingMask = (u8)
7080  ((u8)src->hasSymbolicId | ((u8)src->hasNamespaceUri << 1) |
7081  ((u8)src->hasLocalizedText << 2) | ((u8)src->hasLocale << 3) |
7082  ((u8)src->hasAdditionalInfo << 4) | ((u8)src->hasInnerDiagnosticInfo << 5));
7083 
7084  /* Encode the numeric content */
7085  status ret = Byte_encodeBinary(&encodingMask, NULL);
7086  if(src->hasSymbolicId)
7087  ret |= Int32_encodeBinary(&src->symbolicId);
7088  if(src->hasNamespaceUri)
7089  ret |= Int32_encodeBinary(&src->namespaceUri);
7090  if(src->hasLocalizedText)
7091  ret |= Int32_encodeBinary(&src->localizedText);
7092  if(src->hasLocale)
7093  ret |= Int32_encodeBinary(&src->locale);
7094  if(ret != UA_STATUSCODE_GOOD)
7095  return ret;
7096 
7097  /* Encode the additional info */
7098  if(src->hasAdditionalInfo) {
7099  ret = String_encodeBinary(&src->additionalInfo, NULL);
7100  if(ret != UA_STATUSCODE_GOOD)
7101  return ret;
7102  }
7103 
7104  /* From here on, do not return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as
7105  * the buffer might have been exchanged during encoding of the string. */
7106 
7107  /* Encode the inner status code */
7108  if(src->hasInnerStatusCode) {
7109  ret = encodeNumericWithExchangeBuffer(&src->innerStatusCode,
7110  (UA_encodeBinarySignature)UInt32_encodeBinary);
7112  if(ret != UA_STATUSCODE_GOOD)
7113  return ret;
7114  }
7115 
7116  /* Encode the inner diagnostic info */
7117  if(src->hasInnerDiagnosticInfo)
7118  ret = UA_encodeBinaryInternal(src->innerDiagnosticInfo,
7120 
7122  return ret;
7123 }
7124 
7125 static status
7126 DiagnosticInfo_decodeBinary(UA_DiagnosticInfo *dst, const UA_DataType *_) {
7127  /* Decode the encoding mask */
7128  u8 encodingMask;
7129  status ret = Byte_decodeBinary(&encodingMask, NULL);
7130  if(ret != UA_STATUSCODE_GOOD)
7131  return ret;
7132 
7133  /* Decode the content */
7134  if(encodingMask & 0x01) {
7135  dst->hasSymbolicId = true;
7136  ret |= Int32_decodeBinary(&dst->symbolicId);
7137  }
7138  if(encodingMask & 0x02) {
7139  dst->hasNamespaceUri = true;
7140  ret |= Int32_decodeBinary(&dst->namespaceUri);
7141  }
7142  if(encodingMask & 0x04) {
7143  dst->hasLocalizedText = true;
7144  ret |= Int32_decodeBinary(&dst->localizedText);
7145  }
7146  if(encodingMask & 0x08) {
7147  dst->hasLocale = true;
7148  ret |= Int32_decodeBinary(&dst->locale);
7149  }
7150  if(encodingMask & 0x10) {
7151  dst->hasAdditionalInfo = true;
7152  ret |= String_decodeBinary(&dst->additionalInfo, NULL);
7153  }
7154  if(encodingMask & 0x20) {
7155  dst->hasInnerStatusCode = true;
7156  ret |= StatusCode_decodeBinary(&dst->innerStatusCode);
7157  }
7158  if(encodingMask & 0x40) {
7159  /* innerDiagnosticInfo is allocated on the heap */
7161  UA_calloc(1, sizeof(UA_DiagnosticInfo));
7162  if(!dst->innerDiagnosticInfo)
7164  dst->hasInnerDiagnosticInfo = true;
7165  ret |= DiagnosticInfo_decodeBinary(dst->innerDiagnosticInfo, NULL);
7166  }
7167  return ret;
7168 }
7169 
7170 /********************/
7171 /* Structured Types */
7172 /********************/
7173 
7174 static status
7175 UA_decodeBinaryInternal(void *dst, const UA_DataType *type);
7176 
7177 const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7178  (UA_encodeBinarySignature)Boolean_encodeBinary,
7179  (UA_encodeBinarySignature)Byte_encodeBinary, // SByte
7180  (UA_encodeBinarySignature)Byte_encodeBinary,
7181  (UA_encodeBinarySignature)UInt16_encodeBinary, // Int16
7182  (UA_encodeBinarySignature)UInt16_encodeBinary,
7183  (UA_encodeBinarySignature)UInt32_encodeBinary, // Int32
7184  (UA_encodeBinarySignature)UInt32_encodeBinary,
7185  (UA_encodeBinarySignature)UInt64_encodeBinary, // Int64
7186  (UA_encodeBinarySignature)UInt64_encodeBinary,
7187  (UA_encodeBinarySignature)Float_encodeBinary,
7188  (UA_encodeBinarySignature)Double_encodeBinary,
7189  (UA_encodeBinarySignature)String_encodeBinary,
7190  (UA_encodeBinarySignature)UInt64_encodeBinary, // DateTime
7191  (UA_encodeBinarySignature)Guid_encodeBinary,
7192  (UA_encodeBinarySignature)String_encodeBinary, // ByteString
7193  (UA_encodeBinarySignature)String_encodeBinary, // XmlElement
7194  (UA_encodeBinarySignature)NodeId_encodeBinary,
7195  (UA_encodeBinarySignature)ExpandedNodeId_encodeBinary,
7196  (UA_encodeBinarySignature)UInt32_encodeBinary, // StatusCode
7197  (UA_encodeBinarySignature)UA_encodeBinaryInternal, // QualifiedName
7198  (UA_encodeBinarySignature)LocalizedText_encodeBinary,
7199  (UA_encodeBinarySignature)ExtensionObject_encodeBinary,
7200  (UA_encodeBinarySignature)DataValue_encodeBinary,
7201  (UA_encodeBinarySignature)Variant_encodeBinary,
7202  (UA_encodeBinarySignature)DiagnosticInfo_encodeBinary,
7203  (UA_encodeBinarySignature)UA_encodeBinaryInternal,
7204 };
7205 
7206 static status
7207 UA_encodeBinaryInternal(const void *src, const UA_DataType *type) {
7208  uintptr_t ptr = (uintptr_t)src;
7209  status ret = UA_STATUSCODE_GOOD;
7210  u8 membersSize = type->membersSize;
7211  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7212  for(size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) {
7213  const UA_DataTypeMember *member = &type->members[i];
7214  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7215  if(!member->isArray) {
7216  ptr += member->padding;
7217  size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7218  size_t memSize = membertype->memSize;
7219  u8 *oldpos = g_pos;
7220  ret = encodeBinaryJumpTable[encode_index]((const void*)ptr, membertype);
7221  ptr += memSize;
7223  g_pos = oldpos; /* exchange/send the buffer */
7224  ret = exchangeBuffer();
7225  ptr -= member->padding + memSize; /* encode the same member in the next iteration */
7226  if(ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED || g_pos + memSize > g_end) {
7227  /* the send buffer is too small to encode the member, even after exchangeBuffer */
7229  }
7230  --i;
7231  }
7232  } else {
7233  ptr += member->padding;
7234  const size_t length = *((const size_t*)ptr);
7235  ptr += sizeof(size_t);
7236  ret = Array_encodeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype);
7237  ptr += sizeof(void*);
7238  }
7239  }
7241  return ret;
7242 }
7243 
7244 status
7245 UA_encodeBinary(const void *src, const UA_DataType *type,
7246  UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle,
7247  UA_ByteString *dst, size_t *offset) {
7248  /* Set the (thread-local) pointers to save function arguments */
7249  g_buf = *dst;
7250  g_pos = &dst->data[*offset];
7251  g_end = &dst->data[dst->length];
7252  g_exchangeBufferCallback = exchangeCallback;
7253  g_exchangeBufferCallbackHandle = exchangeHandle;
7254  status ret = UA_encodeBinaryInternal(src, type);
7255 
7256  /* Set the current buffer position. Beware that the buffer might have been
7257  * exchanged internally. */
7258  *dst = g_buf;
7259  *offset = (uintptr_t)(g_pos - g_buf.data);
7260  return ret;
7261 }
7262 
7263 const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7264  (UA_decodeBinarySignature)Boolean_decodeBinary,
7265  (UA_decodeBinarySignature)Byte_decodeBinary, // SByte
7266  (UA_decodeBinarySignature)Byte_decodeBinary,
7267  (UA_decodeBinarySignature)UInt16_decodeBinary, // Int16
7268  (UA_decodeBinarySignature)UInt16_decodeBinary,
7269  (UA_decodeBinarySignature)UInt32_decodeBinary, // Int32
7270  (UA_decodeBinarySignature)UInt32_decodeBinary,
7271  (UA_decodeBinarySignature)UInt64_decodeBinary, // Int64
7272  (UA_decodeBinarySignature)UInt64_decodeBinary,
7273  (UA_decodeBinarySignature)Float_decodeBinary,
7274  (UA_decodeBinarySignature)Double_decodeBinary,
7275  (UA_decodeBinarySignature)String_decodeBinary,
7276  (UA_decodeBinarySignature)UInt64_decodeBinary, // DateTime
7277  (UA_decodeBinarySignature)Guid_decodeBinary,
7278  (UA_decodeBinarySignature)String_decodeBinary, // ByteString
7279  (UA_decodeBinarySignature)String_decodeBinary, // XmlElement
7280  (UA_decodeBinarySignature)NodeId_decodeBinary,
7281  (UA_decodeBinarySignature)ExpandedNodeId_decodeBinary,
7282  (UA_decodeBinarySignature)UInt32_decodeBinary, // StatusCode
7283  (UA_decodeBinarySignature)UA_decodeBinaryInternal, // QualifiedName
7284  (UA_decodeBinarySignature)LocalizedText_decodeBinary,
7285  (UA_decodeBinarySignature)ExtensionObject_decodeBinary,
7286  (UA_decodeBinarySignature)DataValue_decodeBinary,
7287  (UA_decodeBinarySignature)Variant_decodeBinary,
7288  (UA_decodeBinarySignature)DiagnosticInfo_decodeBinary,
7289  (UA_decodeBinarySignature)UA_decodeBinaryInternal
7290 };
7291 
7292 static status
7293 UA_decodeBinaryInternal(void *dst, const UA_DataType *type) {
7294  uintptr_t ptr = (uintptr_t)dst;
7295  status ret = UA_STATUSCODE_GOOD;
7296  u8 membersSize = type->membersSize;
7297  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7298  for(size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) {
7299  const UA_DataTypeMember *member = &type->members[i];
7300  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7301  if(!member->isArray) {
7302  ptr += member->padding;
7303  size_t fi = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7304  size_t memSize = membertype->memSize;
7305  ret |= decodeBinaryJumpTable[fi]((void *UA_RESTRICT)ptr, membertype);
7306  ptr += memSize;
7307  } else {
7308  ptr += member->padding;
7309  size_t *length = (size_t*)ptr;
7310  ptr += sizeof(size_t);
7311  ret |= Array_decodeBinary((void *UA_RESTRICT *UA_RESTRICT)ptr, length, membertype);
7312  ptr += sizeof(void*);
7313  }
7314  }
7315  return ret;
7316 }
7317 
7318 status
7319 UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst,
7320  const UA_DataType *type) {
7321  /* Initialize the destination */
7322  memset(dst, 0, type->memSize);
7323 
7324  /* Set the (thread-local) position and end pointers to save function
7325  * arguments */
7326  g_pos = &src->data[*offset];
7327  g_end = &src->data[src->length];
7328 
7329  /* Decode */
7330  status ret = UA_decodeBinaryInternal(dst, type);
7331 
7332  /* Clean up */
7333  if(ret == UA_STATUSCODE_GOOD)
7334  *offset = (size_t)(g_pos - src->data) / sizeof(u8);
7335  else
7336  UA_deleteMembers(dst, type);
7337  return ret;
7338 }
7339 
7340 /******************/
7341 /* CalcSizeBinary */
7342 /******************/
7343 
7344 static size_t
7345 Array_calcSizeBinary(const void *src, size_t length, const UA_DataType *type) {
7346  size_t s = 4; // length
7347  if(type->overlayable) {
7348  s += type->memSize * length;
7349  return s;
7350  }
7351  uintptr_t ptr = (uintptr_t)src;
7352  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
7353  for(size_t i = 0; i < length; ++i) {
7354  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, type);
7355  ptr += type->memSize;
7356  }
7357  return s;
7358 }
7359 
7360 static size_t
7361 calcSizeBinaryMemSize(const void *UA_RESTRICT p, const UA_DataType *type) {
7362  return type->memSize;
7363 }
7364 
7365 static size_t
7366 String_calcSizeBinary(const UA_String *UA_RESTRICT p, const UA_DataType *_) {
7367  return 4 + p->length;
7368 }
7369 
7370 static size_t
7371 Guid_calcSizeBinary(const UA_Guid *UA_RESTRICT p, const UA_DataType *_) {
7372  return 16;
7373 }
7374 
7375 static size_t
7376 NodeId_calcSizeBinary(const UA_NodeId *UA_RESTRICT src, const UA_DataType *_) {
7377  size_t s = 1; // encoding byte
7378  switch (src->identifierType) {
7379  case UA_NODEIDTYPE_NUMERIC:
7380  if(src->identifier.numeric > UA_UINT16_MAX || src->namespaceIndex > UA_BYTE_MAX) {
7381  s += 6;
7382  } else if(src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) {
7383  s += 3;
7384  } else {
7385  s += 1;
7386  }
7387  break;
7389  case UA_NODEIDTYPE_STRING:
7390  s += 2;
7391  s += String_calcSizeBinary(&src->identifier.string, NULL);
7392  break;
7393  case UA_NODEIDTYPE_GUID:
7394  s += 18;
7395  break;
7396  default:
7397  return 0;
7398  }
7399  return s;
7400 }
7401 
7402 static size_t
7403 ExpandedNodeId_calcSizeBinary(const UA_ExpandedNodeId *src, const UA_DataType *_) {
7404  size_t s = NodeId_calcSizeBinary(&src->nodeId, NULL);
7405  if(src->namespaceUri.length > 0)
7406  s += String_calcSizeBinary(&src->namespaceUri, NULL);
7407  if(src->serverIndex > 0)
7408  s += 4;
7409  return s;
7410 }
7411 
7412 static size_t
7413 LocalizedText_calcSizeBinary(const UA_LocalizedText *src, UA_DataType *_) {
7414  size_t s = 1; // encoding byte
7415  if(src->locale.data)
7416  s += String_calcSizeBinary(&src->locale, NULL);
7417  if(src->text.data)
7418  s += String_calcSizeBinary(&src->text, NULL);
7419  return s;
7420 }
7421 
7422 static size_t
7423 ExtensionObject_calcSizeBinary(const UA_ExtensionObject *src, UA_DataType *_) {
7424  size_t s = 1; // encoding byte
7426  if(!src->content.decoded.type || !src->content.decoded.data)
7427  return 0;
7428  if(src->content.decoded.type->typeId.identifierType != UA_NODEIDTYPE_NUMERIC)
7429  return 0;
7430  s += NodeId_calcSizeBinary(&src->content.decoded.type->typeId, NULL);
7431  s += 4; // length
7432  const UA_DataType *type = src->content.decoded.type;
7433  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
7434  s += calcSizeBinaryJumpTable[encode_index](src->content.decoded.data, type);
7435  } else {
7436  s += NodeId_calcSizeBinary(&src->content.encoded.typeId, NULL);
7437  switch (src->encoding) {
7439  break;
7442  s += String_calcSizeBinary(&src->content.encoded.body, NULL);
7443  break;
7444  default:
7445  return 0;
7446  }
7447  }
7448  return s;
7449 }
7450 
7451 static size_t
7452 Variant_calcSizeBinary(UA_Variant const *src, UA_DataType *_) {
7453  size_t s = 1; /* encoding byte */
7454  if(!src->type)
7455  return s;
7456 
7457  bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
7458  bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
7459  bool isBuiltin = src->type->builtin;
7460 
7461  UA_NodeId typeId;
7462  UA_NodeId_init(&typeId);
7463  size_t encode_index = src->type->typeIndex;
7464  if(!isBuiltin) {
7465  encode_index = UA_BUILTIN_TYPES_COUNT;
7466  typeId = src->type->typeId;
7468  return 0;
7469  }
7470 
7471  size_t length = src->arrayLength;
7472  if(isArray)
7473  s += 4;
7474  else
7475  length = 1;
7476 
7477  uintptr_t ptr = (uintptr_t)src->data;
7478  size_t memSize = src->type->memSize;
7479  for(size_t i = 0; i < length; ++i) {
7480  if(!isBuiltin) {
7481  /* The type is wrapped inside an extensionobject */
7482  s += NodeId_calcSizeBinary(&typeId, NULL);
7483  s += 1 + 4; // encoding byte + length
7484  }
7485  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, src->type);
7486  ptr += memSize;
7487  }
7488 
7489  if(hasDimensions)
7490  s += Array_calcSizeBinary(src->arrayDimensions, src->arrayDimensionsSize,
7492  return s;
7493 }
7494 
7495 static size_t
7496 DataValue_calcSizeBinary(const UA_DataValue *src, UA_DataType *_) {
7497  size_t s = 1; // encoding byte
7498  if(src->hasValue)
7499  s += Variant_calcSizeBinary(&src->value, NULL);
7500  if(src->hasStatus)
7501  s += 4;
7502  if(src->hasSourceTimestamp)
7503  s += 8;
7504  if(src->hasSourcePicoseconds)
7505  s += 2;
7506  if(src->hasServerTimestamp)
7507  s += 8;
7508  if(src->hasServerPicoseconds)
7509  s += 2;
7510  return s;
7511 }
7512 
7513 static size_t
7514 DiagnosticInfo_calcSizeBinary(const UA_DiagnosticInfo *src, UA_DataType *_) {
7515  size_t s = 1; // encoding byte
7516  if(src->hasSymbolicId)
7517  s += 4;
7518  if(src->hasNamespaceUri)
7519  s += 4;
7520  if(src->hasLocalizedText)
7521  s += 4;
7522  if(src->hasLocale)
7523  s += 4;
7524  if(src->hasAdditionalInfo)
7525  s += String_calcSizeBinary(&src->additionalInfo, NULL);
7526  if(src->hasInnerStatusCode)
7527  s += 4;
7528  if(src->hasInnerDiagnosticInfo)
7529  s += DiagnosticInfo_calcSizeBinary(src->innerDiagnosticInfo, NULL);
7530  return s;
7531 }
7532 
7533 const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7534  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Boolean
7535  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Byte
7536  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7537  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int16
7538  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7539  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int32
7540  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7541  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int64
7542  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7543  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Float
7544  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Double
7545  (UA_calcSizeBinarySignature)String_calcSizeBinary,
7546  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // DateTime
7547  (UA_calcSizeBinarySignature)Guid_calcSizeBinary,
7548  (UA_calcSizeBinarySignature)String_calcSizeBinary, // ByteString
7549  (UA_calcSizeBinarySignature)String_calcSizeBinary, // XmlElement
7550  (UA_calcSizeBinarySignature)NodeId_calcSizeBinary,
7551  (UA_calcSizeBinarySignature)ExpandedNodeId_calcSizeBinary,
7552  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // StatusCode
7554  (UA_calcSizeBinarySignature)LocalizedText_calcSizeBinary,
7555  (UA_calcSizeBinarySignature)ExtensionObject_calcSizeBinary,
7556  (UA_calcSizeBinarySignature)DataValue_calcSizeBinary,
7557  (UA_calcSizeBinarySignature)Variant_calcSizeBinary,
7558  (UA_calcSizeBinarySignature)DiagnosticInfo_calcSizeBinary,
7560 };
7561 
7562 size_t
7563 UA_calcSizeBinary(void *p, const UA_DataType *type) {
7564  size_t s = 0;
7565  uintptr_t ptr = (uintptr_t)p;
7566  u8 membersSize = type->membersSize;
7567  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7568  for(size_t i = 0; i < membersSize; ++i) {
7569  const UA_DataTypeMember *member = &type->members[i];
7570  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7571  if(!member->isArray) {
7572  ptr += member->padding;
7573  size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7574  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, membertype);
7575  ptr += membertype->memSize;
7576  } else {
7577  ptr += member->padding;
7578  const size_t length = *((const size_t*)ptr);
7579  ptr += sizeof(size_t);
7580  s += Array_calcSizeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype);
7581  ptr += sizeof(void*);
7582  }
7583  }
7584  return s;
7585 }
7586 
7587 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_types_generated.c" ***********************************/
7588 
7589 /* Generated from Opc.Ua.Types.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
7590  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:07 */
7591 
7592 
7593 /* Boolean */
7594 static UA_DataTypeMember Boolean_members[1] = {
7596 #ifdef UA_ENABLE_TYPENAMES
7597  .memberName = "",
7598 #endif
7599  .namespaceZero = true,
7600  .padding = 0,
7601  .isArray = false
7602  },};
7603 
7604 /* SByte */
7605 static UA_DataTypeMember SByte_members[1] = {
7607 #ifdef UA_ENABLE_TYPENAMES
7608  .memberName = "",
7609 #endif
7610  .namespaceZero = true,
7611  .padding = 0,
7612  .isArray = false
7613  },};
7614 
7615 /* Byte */
7616 static UA_DataTypeMember Byte_members[1] = {
7618 #ifdef UA_ENABLE_TYPENAMES
7619  .memberName = "",
7620 #endif
7621  .namespaceZero = true,
7622  .padding = 0,
7623  .isArray = false
7624  },};
7625 
7626 /* Int16 */
7627 static UA_DataTypeMember Int16_members[1] = {
7629 #ifdef UA_ENABLE_TYPENAMES
7630  .memberName = "",
7631 #endif
7632  .namespaceZero = true,
7633  .padding = 0,
7634  .isArray = false
7635  },};
7636 
7637 /* UInt16 */
7638 static UA_DataTypeMember UInt16_members[1] = {
7640 #ifdef UA_ENABLE_TYPENAMES
7641  .memberName = "",
7642 #endif
7643  .namespaceZero = true,
7644  .padding = 0,
7645  .isArray = false
7646  },};
7647 
7648 /* Int32 */
7649 static UA_DataTypeMember Int32_members[1] = {
7651 #ifdef UA_ENABLE_TYPENAMES
7652  .memberName = "",
7653 #endif
7654  .namespaceZero = true,
7655  .padding = 0,
7656  .isArray = false
7657  },};
7658 
7659 /* UInt32 */
7660 static UA_DataTypeMember UInt32_members[1] = {
7662 #ifdef UA_ENABLE_TYPENAMES
7663  .memberName = "",
7664 #endif
7665  .namespaceZero = true,
7666  .padding = 0,
7667  .isArray = false
7668  },};
7669 
7670 /* Int64 */
7671 static UA_DataTypeMember Int64_members[1] = {
7673 #ifdef UA_ENABLE_TYPENAMES
7674  .memberName = "",
7675 #endif
7676  .namespaceZero = true,
7677  .padding = 0,
7678  .isArray = false
7679  },};
7680 
7681 /* UInt64 */
7682 static UA_DataTypeMember UInt64_members[1] = {
7684 #ifdef UA_ENABLE_TYPENAMES
7685  .memberName = "",
7686 #endif
7687  .namespaceZero = true,
7688  .padding = 0,
7689  .isArray = false
7690  },};
7691 
7692 /* Float */
7693 static UA_DataTypeMember Float_members[1] = {
7695 #ifdef UA_ENABLE_TYPENAMES
7696  .memberName = "",
7697 #endif
7698  .namespaceZero = true,
7699  .padding = 0,
7700  .isArray = false
7701  },};
7702 
7703 /* Double */
7704 static UA_DataTypeMember Double_members[1] = {
7706 #ifdef UA_ENABLE_TYPENAMES
7707  .memberName = "",
7708 #endif
7709  .namespaceZero = true,
7710  .padding = 0,
7711  .isArray = false
7712  },};
7713 
7714 /* String */
7715 static UA_DataTypeMember String_members[1] = {
7717 #ifdef UA_ENABLE_TYPENAMES
7718  .memberName = "",
7719 #endif
7720  .namespaceZero = true,
7721  .padding = 0,
7722  .isArray = true
7723  },};
7724 
7725 /* DateTime */
7726 static UA_DataTypeMember DateTime_members[1] = {
7728 #ifdef UA_ENABLE_TYPENAMES
7729  .memberName = "",
7730 #endif
7731  .namespaceZero = true,
7732  .padding = 0,
7733  .isArray = false
7734  },};
7735 
7736 /* Guid */
7737 static UA_DataTypeMember Guid_members[1] = {
7739 #ifdef UA_ENABLE_TYPENAMES
7740  .memberName = "",
7741 #endif
7742  .namespaceZero = true,
7743  .padding = 0,
7744  .isArray = false
7745  },};
7746 
7747 /* ByteString */
7748 static UA_DataTypeMember ByteString_members[1] = {
7750 #ifdef UA_ENABLE_TYPENAMES
7751  .memberName = "",
7752 #endif
7753  .namespaceZero = true,
7754  .padding = 0,
7755  .isArray = true
7756  },};
7757 
7758 /* XmlElement */
7759 static UA_DataTypeMember XmlElement_members[1] = {
7761 #ifdef UA_ENABLE_TYPENAMES
7762  .memberName = "",
7763 #endif
7764  .namespaceZero = true,
7765  .padding = 0,
7766  .isArray = true
7767  },};
7768 
7769 /* NodeId */
7770 static UA_DataTypeMember NodeId_members[1] = {
7772 #ifdef UA_ENABLE_TYPENAMES
7773  .memberName = "",
7774 #endif
7775  .namespaceZero = true,
7776  .padding = 0,
7777  .isArray = false
7778  },};
7779 
7780 /* ExpandedNodeId */
7781 static UA_DataTypeMember ExpandedNodeId_members[1] = {
7783 #ifdef UA_ENABLE_TYPENAMES
7784  .memberName = "",
7785 #endif
7786  .namespaceZero = true,
7787  .padding = 0,
7788  .isArray = false
7789  },};
7790 
7791 /* StatusCode */
7792 static UA_DataTypeMember StatusCode_members[1] = {
7794 #ifdef UA_ENABLE_TYPENAMES
7795  .memberName = "",
7796 #endif
7797  .namespaceZero = true,
7798  .padding = 0,
7799  .isArray = false
7800  },};
7801 
7802 /* QualifiedName */
7803 static UA_DataTypeMember QualifiedName_members[2] = {
7805 #ifdef UA_ENABLE_TYPENAMES
7806  .memberName = "namespaceIndex",
7807 #endif
7808  .namespaceZero = true,
7809  .padding = 0,
7810  .isArray = false
7811  },
7812  { .memberTypeIndex = UA_TYPES_STRING,
7813 #ifdef UA_ENABLE_TYPENAMES
7814  .memberName = "name",
7815 #endif
7816  .namespaceZero = true,
7817  .padding = offsetof(UA_QualifiedName, name) - offsetof(UA_QualifiedName, namespaceIndex) - sizeof(UA_Int16),
7818  .isArray = false
7819  },};
7820 
7821 /* LocalizedText */
7822 static UA_DataTypeMember LocalizedText_members[1] = {
7824 #ifdef UA_ENABLE_TYPENAMES
7825  .memberName = "",
7826 #endif
7827  .namespaceZero = true,
7828  .padding = 0,
7829  .isArray = false
7830  },};
7831 
7832 /* ExtensionObject */
7833 static UA_DataTypeMember ExtensionObject_members[1] = {
7835 #ifdef UA_ENABLE_TYPENAMES
7836  .memberName = "",
7837 #endif
7838  .namespaceZero = true,
7839  .padding = 0,
7840  .isArray = false
7841  },};
7842 
7843 /* DataValue */
7844 static UA_DataTypeMember DataValue_members[1] = {
7846 #ifdef UA_ENABLE_TYPENAMES
7847  .memberName = "",
7848 #endif
7849  .namespaceZero = true,
7850  .padding = 0,
7851  .isArray = false
7852  },};
7853 
7854 /* Variant */
7855 static UA_DataTypeMember Variant_members[1] = {
7857 #ifdef UA_ENABLE_TYPENAMES
7858  .memberName = "",
7859 #endif
7860  .namespaceZero = true,
7861  .padding = 0,
7862  .isArray = false
7863  },};
7864 
7865 /* DiagnosticInfo */
7866 static UA_DataTypeMember DiagnosticInfo_members[1] = {
7868 #ifdef UA_ENABLE_TYPENAMES
7869  .memberName = "",
7870 #endif
7871  .namespaceZero = true,
7872  .padding = 0,
7873  .isArray = false
7874  },};
7875 
7876 /* SignedSoftwareCertificate */
7877 static UA_DataTypeMember SignedSoftwareCertificate_members[2] = {
7879 #ifdef UA_ENABLE_TYPENAMES
7880  .memberName = "certificateData",
7881 #endif
7882  .namespaceZero = true,
7883  .padding = 0,
7884  .isArray = false
7885  },
7886  { .memberTypeIndex = UA_TYPES_BYTESTRING,
7887 #ifdef UA_ENABLE_TYPENAMES
7888  .memberName = "signature",
7889 #endif
7890  .namespaceZero = true,
7891  .padding = offsetof(UA_SignedSoftwareCertificate, signature) - offsetof(UA_SignedSoftwareCertificate, certificateData) - sizeof(UA_ByteString),
7892  .isArray = false
7893  },};
7894 
7895 /* BrowsePathTarget */
7896 static UA_DataTypeMember BrowsePathTarget_members[2] = {
7898 #ifdef UA_ENABLE_TYPENAMES
7899  .memberName = "targetId",
7900 #endif
7901  .namespaceZero = true,
7902  .padding = 0,
7903  .isArray = false
7904  },
7905  { .memberTypeIndex = UA_TYPES_UINT32,
7906 #ifdef UA_ENABLE_TYPENAMES
7907  .memberName = "remainingPathIndex",
7908 #endif
7909  .namespaceZero = true,
7910  .padding = offsetof(UA_BrowsePathTarget, remainingPathIndex) - offsetof(UA_BrowsePathTarget, targetId) - sizeof(UA_ExpandedNodeId),
7911  .isArray = false
7912  },};
7913 
7914 /* ViewAttributes */
7915 static UA_DataTypeMember ViewAttributes_members[7] = {
7917 #ifdef UA_ENABLE_TYPENAMES
7918  .memberName = "specifiedAttributes",
7919 #endif
7920  .namespaceZero = true,
7921  .padding = 0,
7922  .isArray = false
7923  },
7924  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
7925 #ifdef UA_ENABLE_TYPENAMES
7926  .memberName = "displayName",
7927 #endif
7928  .namespaceZero = true,
7929  .padding = offsetof(UA_ViewAttributes, displayName) - offsetof(UA_ViewAttributes, specifiedAttributes) - sizeof(UA_UInt32),
7930  .isArray = false
7931  },
7932  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
7933 #ifdef UA_ENABLE_TYPENAMES
7934  .memberName = "description",
7935 #endif
7936  .namespaceZero = true,
7937  .padding = offsetof(UA_ViewAttributes, description) - offsetof(UA_ViewAttributes, displayName) - sizeof(UA_LocalizedText),
7938  .isArray = false
7939  },
7940  { .memberTypeIndex = UA_TYPES_UINT32,
7941 #ifdef UA_ENABLE_TYPENAMES
7942  .memberName = "writeMask",
7943 #endif
7944  .namespaceZero = true,
7945  .padding = offsetof(UA_ViewAttributes, writeMask) - offsetof(UA_ViewAttributes, description) - sizeof(UA_LocalizedText),
7946  .isArray = false
7947  },
7948  { .memberTypeIndex = UA_TYPES_UINT32,
7949 #ifdef UA_ENABLE_TYPENAMES
7950  .memberName = "userWriteMask",
7951 #endif
7952  .namespaceZero = true,
7953  .padding = offsetof(UA_ViewAttributes, userWriteMask) - offsetof(UA_ViewAttributes, writeMask) - sizeof(UA_UInt32),
7954  .isArray = false
7955  },
7956  { .memberTypeIndex = UA_TYPES_BOOLEAN,
7957 #ifdef UA_ENABLE_TYPENAMES
7958  .memberName = "containsNoLoops",
7959 #endif
7960  .namespaceZero = true,
7961  .padding = offsetof(UA_ViewAttributes, containsNoLoops) - offsetof(UA_ViewAttributes, userWriteMask) - sizeof(UA_UInt32),
7962  .isArray = false
7963  },
7964  { .memberTypeIndex = UA_TYPES_BYTE,
7965 #ifdef UA_ENABLE_TYPENAMES
7966  .memberName = "eventNotifier",
7967 #endif
7968  .namespaceZero = true,
7969  .padding = offsetof(UA_ViewAttributes, eventNotifier) - offsetof(UA_ViewAttributes, containsNoLoops) - sizeof(UA_Boolean),
7970  .isArray = false
7971  },};
7972 
7973 /* BrowseResultMask */
7974 static UA_DataTypeMember BrowseResultMask_members[1] = {
7976 #ifdef UA_ENABLE_TYPENAMES
7977  .memberName = "",
7978 #endif
7979  .namespaceZero = true,
7980  .padding = 0,
7981  .isArray = false
7982  },};
7983 
7984 /* RequestHeader */
7985 static UA_DataTypeMember RequestHeader_members[7] = {
7987 #ifdef UA_ENABLE_TYPENAMES
7988  .memberName = "authenticationToken",
7989 #endif
7990  .namespaceZero = true,
7991  .padding = 0,
7992  .isArray = false
7993  },
7994  { .memberTypeIndex = UA_TYPES_DATETIME,
7995 #ifdef UA_ENABLE_TYPENAMES
7996  .memberName = "timestamp",
7997 #endif
7998  .namespaceZero = true,
7999  .padding = offsetof(UA_RequestHeader, timestamp) - offsetof(UA_RequestHeader, authenticationToken) - sizeof(UA_NodeId),
8000  .isArray = false
8001  },
8002  { .memberTypeIndex = UA_TYPES_UINT32,
8003 #ifdef UA_ENABLE_TYPENAMES
8004  .memberName = "requestHandle",
8005 #endif
8006  .namespaceZero = true,
8007  .padding = offsetof(UA_RequestHeader, requestHandle) - offsetof(UA_RequestHeader, timestamp) - sizeof(UA_DateTime),
8008  .isArray = false
8009  },
8010  { .memberTypeIndex = UA_TYPES_UINT32,
8011 #ifdef UA_ENABLE_TYPENAMES
8012  .memberName = "returnDiagnostics",
8013 #endif
8014  .namespaceZero = true,
8015  .padding = offsetof(UA_RequestHeader, returnDiagnostics) - offsetof(UA_RequestHeader, requestHandle) - sizeof(UA_UInt32),
8016  .isArray = false
8017  },
8018  { .memberTypeIndex = UA_TYPES_STRING,
8019 #ifdef UA_ENABLE_TYPENAMES
8020  .memberName = "auditEntryId",
8021 #endif
8022  .namespaceZero = true,
8023  .padding = offsetof(UA_RequestHeader, auditEntryId) - offsetof(UA_RequestHeader, returnDiagnostics) - sizeof(UA_UInt32),
8024  .isArray = false
8025  },
8026  { .memberTypeIndex = UA_TYPES_UINT32,
8027 #ifdef UA_ENABLE_TYPENAMES
8028  .memberName = "timeoutHint",
8029 #endif
8030  .namespaceZero = true,
8031  .padding = offsetof(UA_RequestHeader, timeoutHint) - offsetof(UA_RequestHeader, auditEntryId) - sizeof(UA_String),
8032  .isArray = false
8033  },
8034  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8035 #ifdef UA_ENABLE_TYPENAMES
8036  .memberName = "additionalHeader",
8037 #endif
8038  .namespaceZero = true,
8039  .padding = offsetof(UA_RequestHeader, additionalHeader) - offsetof(UA_RequestHeader, timeoutHint) - sizeof(UA_UInt32),
8040  .isArray = false
8041  },};
8042 
8043 /* MonitoredItemModifyResult */
8044 static UA_DataTypeMember MonitoredItemModifyResult_members[4] = {
8046 #ifdef UA_ENABLE_TYPENAMES
8047  .memberName = "statusCode",
8048 #endif
8049  .namespaceZero = true,
8050  .padding = 0,
8051  .isArray = false
8052  },
8053  { .memberTypeIndex = UA_TYPES_DOUBLE,
8054 #ifdef UA_ENABLE_TYPENAMES
8055  .memberName = "revisedSamplingInterval",
8056 #endif
8057  .namespaceZero = true,
8058  .padding = offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - offsetof(UA_MonitoredItemModifyResult, statusCode) - sizeof(UA_StatusCode),
8059  .isArray = false
8060  },
8061  { .memberTypeIndex = UA_TYPES_UINT32,
8062 #ifdef UA_ENABLE_TYPENAMES
8063  .memberName = "revisedQueueSize",
8064 #endif
8065  .namespaceZero = true,
8066  .padding = offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - sizeof(UA_Double),
8067  .isArray = false
8068  },
8069  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8070 #ifdef UA_ENABLE_TYPENAMES
8071  .memberName = "filterResult",
8072 #endif
8073  .namespaceZero = true,
8074  .padding = offsetof(UA_MonitoredItemModifyResult, filterResult) - offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - sizeof(UA_UInt32),
8075  .isArray = false
8076  },};
8077 
8078 /* CloseSecureChannelRequest */
8079 static UA_DataTypeMember CloseSecureChannelRequest_members[1] = {
8081 #ifdef UA_ENABLE_TYPENAMES
8082  .memberName = "requestHeader",
8083 #endif
8084  .namespaceZero = true,
8085  .padding = 0,
8086  .isArray = false
8087  },};
8088 
8089 /* AddNodesResult */
8090 static UA_DataTypeMember AddNodesResult_members[2] = {
8092 #ifdef UA_ENABLE_TYPENAMES
8093  .memberName = "statusCode",
8094 #endif
8095  .namespaceZero = true,
8096  .padding = 0,
8097  .isArray = false
8098  },
8099  { .memberTypeIndex = UA_TYPES_NODEID,
8100 #ifdef UA_ENABLE_TYPENAMES
8101  .memberName = "addedNodeId",
8102 #endif
8103  .namespaceZero = true,
8104  .padding = offsetof(UA_AddNodesResult, addedNodeId) - offsetof(UA_AddNodesResult, statusCode) - sizeof(UA_StatusCode),
8105  .isArray = false
8106  },};
8107 
8108 /* VariableAttributes */
8109 static UA_DataTypeMember VariableAttributes_members[13] = {
8111 #ifdef UA_ENABLE_TYPENAMES
8112  .memberName = "specifiedAttributes",
8113 #endif
8114  .namespaceZero = true,
8115  .padding = 0,
8116  .isArray = false
8117  },
8118  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8119 #ifdef UA_ENABLE_TYPENAMES
8120  .memberName = "displayName",
8121 #endif
8122  .namespaceZero = true,
8123  .padding = offsetof(UA_VariableAttributes, displayName) - offsetof(UA_VariableAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8124  .isArray = false
8125  },
8126  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8127 #ifdef UA_ENABLE_TYPENAMES
8128  .memberName = "description",
8129 #endif
8130  .namespaceZero = true,
8131  .padding = offsetof(UA_VariableAttributes, description) - offsetof(UA_VariableAttributes, displayName) - sizeof(UA_LocalizedText),
8132  .isArray = false
8133  },
8134  { .memberTypeIndex = UA_TYPES_UINT32,
8135 #ifdef UA_ENABLE_TYPENAMES
8136  .memberName = "writeMask",
8137 #endif
8138  .namespaceZero = true,
8139  .padding = offsetof(UA_VariableAttributes, writeMask) - offsetof(UA_VariableAttributes, description) - sizeof(UA_LocalizedText),
8140  .isArray = false
8141  },
8142  { .memberTypeIndex = UA_TYPES_UINT32,
8143 #ifdef UA_ENABLE_TYPENAMES
8144  .memberName = "userWriteMask",
8145 #endif
8146  .namespaceZero = true,
8147  .padding = offsetof(UA_VariableAttributes, userWriteMask) - offsetof(UA_VariableAttributes, writeMask) - sizeof(UA_UInt32),
8148  .isArray = false
8149  },
8150  { .memberTypeIndex = UA_TYPES_VARIANT,
8151 #ifdef UA_ENABLE_TYPENAMES
8152  .memberName = "value",
8153 #endif
8154  .namespaceZero = true,
8155  .padding = offsetof(UA_VariableAttributes, value) - offsetof(UA_VariableAttributes, userWriteMask) - sizeof(UA_UInt32),
8156  .isArray = false
8157  },
8158  { .memberTypeIndex = UA_TYPES_NODEID,
8159 #ifdef UA_ENABLE_TYPENAMES
8160  .memberName = "dataType",
8161 #endif
8162  .namespaceZero = true,
8163  .padding = offsetof(UA_VariableAttributes, dataType) - offsetof(UA_VariableAttributes, value) - sizeof(UA_Variant),
8164  .isArray = false
8165  },
8166  { .memberTypeIndex = UA_TYPES_INT32,
8167 #ifdef UA_ENABLE_TYPENAMES
8168  .memberName = "valueRank",
8169 #endif
8170  .namespaceZero = true,
8171  .padding = offsetof(UA_VariableAttributes, valueRank) - offsetof(UA_VariableAttributes, dataType) - sizeof(UA_NodeId),
8172  .isArray = false
8173  },
8174  { .memberTypeIndex = UA_TYPES_UINT32,
8175 #ifdef UA_ENABLE_TYPENAMES
8176  .memberName = "arrayDimensions",
8177 #endif
8178  .namespaceZero = true,
8179  .padding = offsetof(UA_VariableAttributes, arrayDimensionsSize) - offsetof(UA_VariableAttributes, valueRank) - sizeof(UA_Int32),
8180  .isArray = true
8181  },
8182  { .memberTypeIndex = UA_TYPES_BYTE,
8183 #ifdef UA_ENABLE_TYPENAMES
8184  .memberName = "accessLevel",
8185 #endif
8186  .namespaceZero = true,
8187  .padding = offsetof(UA_VariableAttributes, accessLevel) - offsetof(UA_VariableAttributes, arrayDimensions) - sizeof(void*),
8188  .isArray = false
8189  },
8190  { .memberTypeIndex = UA_TYPES_BYTE,
8191 #ifdef UA_ENABLE_TYPENAMES
8192  .memberName = "userAccessLevel",
8193 #endif
8194  .namespaceZero = true,
8195  .padding = offsetof(UA_VariableAttributes, userAccessLevel) - offsetof(UA_VariableAttributes, accessLevel) - sizeof(UA_Byte),
8196  .isArray = false
8197  },
8198  { .memberTypeIndex = UA_TYPES_DOUBLE,
8199 #ifdef UA_ENABLE_TYPENAMES
8200  .memberName = "minimumSamplingInterval",
8201 #endif
8202  .namespaceZero = true,
8203  .padding = offsetof(UA_VariableAttributes, minimumSamplingInterval) - offsetof(UA_VariableAttributes, userAccessLevel) - sizeof(UA_Byte),
8204  .isArray = false
8205  },
8206  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8207 #ifdef UA_ENABLE_TYPENAMES
8208  .memberName = "historizing",
8209 #endif
8210  .namespaceZero = true,
8211  .padding = offsetof(UA_VariableAttributes, historizing) - offsetof(UA_VariableAttributes, minimumSamplingInterval) - sizeof(UA_Double),
8212  .isArray = false
8213  },};
8214 
8215 /* NotificationMessage */
8216 static UA_DataTypeMember NotificationMessage_members[3] = {
8218 #ifdef UA_ENABLE_TYPENAMES
8219  .memberName = "sequenceNumber",
8220 #endif
8221  .namespaceZero = true,
8222  .padding = 0,
8223  .isArray = false
8224  },
8225  { .memberTypeIndex = UA_TYPES_DATETIME,
8226 #ifdef UA_ENABLE_TYPENAMES
8227  .memberName = "publishTime",
8228 #endif
8229  .namespaceZero = true,
8230  .padding = offsetof(UA_NotificationMessage, publishTime) - offsetof(UA_NotificationMessage, sequenceNumber) - sizeof(UA_UInt32),
8231  .isArray = false
8232  },
8233  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8234 #ifdef UA_ENABLE_TYPENAMES
8235  .memberName = "notificationData",
8236 #endif
8237  .namespaceZero = true,
8238  .padding = offsetof(UA_NotificationMessage, notificationDataSize) - offsetof(UA_NotificationMessage, publishTime) - sizeof(UA_DateTime),
8239  .isArray = true
8240  },};
8241 
8242 /* NodeAttributesMask */
8243 static UA_DataTypeMember NodeAttributesMask_members[1] = {
8245 #ifdef UA_ENABLE_TYPENAMES
8246  .memberName = "",
8247 #endif
8248  .namespaceZero = true,
8249  .padding = 0,
8250  .isArray = false
8251  },};
8252 
8253 /* MonitoringMode */
8254 static UA_DataTypeMember MonitoringMode_members[1] = {
8256 #ifdef UA_ENABLE_TYPENAMES
8257  .memberName = "",
8258 #endif
8259  .namespaceZero = true,
8260  .padding = 0,
8261  .isArray = false
8262  },};
8263 
8264 /* CallMethodResult */
8265 static UA_DataTypeMember CallMethodResult_members[4] = {
8267 #ifdef UA_ENABLE_TYPENAMES
8268  .memberName = "statusCode",
8269 #endif
8270  .namespaceZero = true,
8271  .padding = 0,
8272  .isArray = false
8273  },
8274  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8275 #ifdef UA_ENABLE_TYPENAMES
8276  .memberName = "inputArgumentResults",
8277 #endif
8278  .namespaceZero = true,
8279  .padding = offsetof(UA_CallMethodResult, inputArgumentResultsSize) - offsetof(UA_CallMethodResult, statusCode) - sizeof(UA_StatusCode),
8280  .isArray = true
8281  },
8282  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8283 #ifdef UA_ENABLE_TYPENAMES
8284  .memberName = "inputArgumentDiagnosticInfos",
8285 #endif
8286  .namespaceZero = true,
8287  .padding = offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfosSize) - offsetof(UA_CallMethodResult, inputArgumentResults) - sizeof(void*),
8288  .isArray = true
8289  },
8290  { .memberTypeIndex = UA_TYPES_VARIANT,
8291 #ifdef UA_ENABLE_TYPENAMES
8292  .memberName = "outputArguments",
8293 #endif
8294  .namespaceZero = true,
8295  .padding = offsetof(UA_CallMethodResult, outputArgumentsSize) - offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfos) - sizeof(void*),
8296  .isArray = true
8297  },};
8298 
8299 /* ParsingResult */
8300 static UA_DataTypeMember ParsingResult_members[3] = {
8302 #ifdef UA_ENABLE_TYPENAMES
8303  .memberName = "statusCode",
8304 #endif
8305  .namespaceZero = true,
8306  .padding = 0,
8307  .isArray = false
8308  },
8309  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8310 #ifdef UA_ENABLE_TYPENAMES
8311  .memberName = "dataStatusCodes",
8312 #endif
8313  .namespaceZero = true,
8314  .padding = offsetof(UA_ParsingResult, dataStatusCodesSize) - offsetof(UA_ParsingResult, statusCode) - sizeof(UA_StatusCode),
8315  .isArray = true
8316  },
8317  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8318 #ifdef UA_ENABLE_TYPENAMES
8319  .memberName = "dataDiagnosticInfos",
8320 #endif
8321  .namespaceZero = true,
8322  .padding = offsetof(UA_ParsingResult, dataDiagnosticInfosSize) - offsetof(UA_ParsingResult, dataStatusCodes) - sizeof(void*),
8323  .isArray = true
8324  },};
8325 
8326 /* RelativePathElement */
8327 static UA_DataTypeMember RelativePathElement_members[4] = {
8329 #ifdef UA_ENABLE_TYPENAMES
8330  .memberName = "referenceTypeId",
8331 #endif
8332  .namespaceZero = true,
8333  .padding = 0,
8334  .isArray = false
8335  },
8336  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8337 #ifdef UA_ENABLE_TYPENAMES
8338  .memberName = "isInverse",
8339 #endif
8340  .namespaceZero = true,
8341  .padding = offsetof(UA_RelativePathElement, isInverse) - offsetof(UA_RelativePathElement, referenceTypeId) - sizeof(UA_NodeId),
8342  .isArray = false
8343  },
8344  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8345 #ifdef UA_ENABLE_TYPENAMES
8346  .memberName = "includeSubtypes",
8347 #endif
8348  .namespaceZero = true,
8349  .padding = offsetof(UA_RelativePathElement, includeSubtypes) - offsetof(UA_RelativePathElement, isInverse) - sizeof(UA_Boolean),
8350  .isArray = false
8351  },
8352  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
8353 #ifdef UA_ENABLE_TYPENAMES
8354  .memberName = "targetName",
8355 #endif
8356  .namespaceZero = true,
8357  .padding = offsetof(UA_RelativePathElement, targetName) - offsetof(UA_RelativePathElement, includeSubtypes) - sizeof(UA_Boolean),
8358  .isArray = false
8359  },};
8360 
8361 /* BrowseDirection */
8362 static UA_DataTypeMember BrowseDirection_members[1] = {
8364 #ifdef UA_ENABLE_TYPENAMES
8365  .memberName = "",
8366 #endif
8367  .namespaceZero = true,
8368  .padding = 0,
8369  .isArray = false
8370  },};
8371 
8372 /* CallMethodRequest */
8373 static UA_DataTypeMember CallMethodRequest_members[3] = {
8375 #ifdef UA_ENABLE_TYPENAMES
8376  .memberName = "objectId",
8377 #endif
8378  .namespaceZero = true,
8379  .padding = 0,
8380  .isArray = false
8381  },
8382  { .memberTypeIndex = UA_TYPES_NODEID,
8383 #ifdef UA_ENABLE_TYPENAMES
8384  .memberName = "methodId",
8385 #endif
8386  .namespaceZero = true,
8387  .padding = offsetof(UA_CallMethodRequest, methodId) - offsetof(UA_CallMethodRequest, objectId) - sizeof(UA_NodeId),
8388  .isArray = false
8389  },
8390  { .memberTypeIndex = UA_TYPES_VARIANT,
8391 #ifdef UA_ENABLE_TYPENAMES
8392  .memberName = "inputArguments",
8393 #endif
8394  .namespaceZero = true,
8395  .padding = offsetof(UA_CallMethodRequest, inputArgumentsSize) - offsetof(UA_CallMethodRequest, methodId) - sizeof(UA_NodeId),
8396  .isArray = true
8397  },};
8398 
8399 /* UnregisterNodesRequest */
8400 static UA_DataTypeMember UnregisterNodesRequest_members[2] = {
8402 #ifdef UA_ENABLE_TYPENAMES
8403  .memberName = "requestHeader",
8404 #endif
8405  .namespaceZero = true,
8406  .padding = 0,
8407  .isArray = false
8408  },
8409  { .memberTypeIndex = UA_TYPES_NODEID,
8410 #ifdef UA_ENABLE_TYPENAMES
8411  .memberName = "nodesToUnregister",
8412 #endif
8413  .namespaceZero = true,
8414  .padding = offsetof(UA_UnregisterNodesRequest, nodesToUnregisterSize) - offsetof(UA_UnregisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
8415  .isArray = true
8416  },};
8417 
8418 /* ContentFilterElementResult */
8419 static UA_DataTypeMember ContentFilterElementResult_members[3] = {
8421 #ifdef UA_ENABLE_TYPENAMES
8422  .memberName = "statusCode",
8423 #endif
8424  .namespaceZero = true,
8425  .padding = 0,
8426  .isArray = false
8427  },
8428  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8429 #ifdef UA_ENABLE_TYPENAMES
8430  .memberName = "operandStatusCodes",
8431 #endif
8432  .namespaceZero = true,
8433  .padding = offsetof(UA_ContentFilterElementResult, operandStatusCodesSize) - offsetof(UA_ContentFilterElementResult, statusCode) - sizeof(UA_StatusCode),
8434  .isArray = true
8435  },
8436  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8437 #ifdef UA_ENABLE_TYPENAMES
8438  .memberName = "operandDiagnosticInfos",
8439 #endif
8440  .namespaceZero = true,
8441  .padding = offsetof(UA_ContentFilterElementResult, operandDiagnosticInfosSize) - offsetof(UA_ContentFilterElementResult, operandStatusCodes) - sizeof(void*),
8442  .isArray = true
8443  },};
8444 
8445 /* QueryDataSet */
8446 static UA_DataTypeMember QueryDataSet_members[3] = {
8448 #ifdef UA_ENABLE_TYPENAMES
8449  .memberName = "nodeId",
8450 #endif
8451  .namespaceZero = true,
8452  .padding = 0,
8453  .isArray = false
8454  },
8455  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8456 #ifdef UA_ENABLE_TYPENAMES
8457  .memberName = "typeDefinitionNode",
8458 #endif
8459  .namespaceZero = true,
8460  .padding = offsetof(UA_QueryDataSet, typeDefinitionNode) - offsetof(UA_QueryDataSet, nodeId) - sizeof(UA_ExpandedNodeId),
8461  .isArray = false
8462  },
8463  { .memberTypeIndex = UA_TYPES_VARIANT,
8464 #ifdef UA_ENABLE_TYPENAMES
8465  .memberName = "values",
8466 #endif
8467  .namespaceZero = true,
8468  .padding = offsetof(UA_QueryDataSet, valuesSize) - offsetof(UA_QueryDataSet, typeDefinitionNode) - sizeof(UA_ExpandedNodeId),
8469  .isArray = true
8470  },};
8471 
8472 /* AnonymousIdentityToken */
8473 static UA_DataTypeMember AnonymousIdentityToken_members[1] = {
8475 #ifdef UA_ENABLE_TYPENAMES
8476  .memberName = "policyId",
8477 #endif
8478  .namespaceZero = true,
8479  .padding = 0,
8480  .isArray = false
8481  },};
8482 
8483 /* SetPublishingModeRequest */
8484 static UA_DataTypeMember SetPublishingModeRequest_members[3] = {
8486 #ifdef UA_ENABLE_TYPENAMES
8487  .memberName = "requestHeader",
8488 #endif
8489  .namespaceZero = true,
8490  .padding = 0,
8491  .isArray = false
8492  },
8493  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8494 #ifdef UA_ENABLE_TYPENAMES
8495  .memberName = "publishingEnabled",
8496 #endif
8497  .namespaceZero = true,
8498  .padding = offsetof(UA_SetPublishingModeRequest, publishingEnabled) - offsetof(UA_SetPublishingModeRequest, requestHeader) - sizeof(UA_RequestHeader),
8499  .isArray = false
8500  },
8501  { .memberTypeIndex = UA_TYPES_UINT32,
8502 #ifdef UA_ENABLE_TYPENAMES
8503  .memberName = "subscriptionIds",
8504 #endif
8505  .namespaceZero = true,
8506  .padding = offsetof(UA_SetPublishingModeRequest, subscriptionIdsSize) - offsetof(UA_SetPublishingModeRequest, publishingEnabled) - sizeof(UA_Boolean),
8507  .isArray = true
8508  },};
8509 
8510 /* TimestampsToReturn */
8511 static UA_DataTypeMember TimestampsToReturn_members[1] = {
8513 #ifdef UA_ENABLE_TYPENAMES
8514  .memberName = "",
8515 #endif
8516  .namespaceZero = true,
8517  .padding = 0,
8518  .isArray = false
8519  },};
8520 
8521 /* CallRequest */
8522 static UA_DataTypeMember CallRequest_members[2] = {
8524 #ifdef UA_ENABLE_TYPENAMES
8525  .memberName = "requestHeader",
8526 #endif
8527  .namespaceZero = true,
8528  .padding = 0,
8529  .isArray = false
8530  },
8531  { .memberTypeIndex = UA_TYPES_CALLMETHODREQUEST,
8532 #ifdef UA_ENABLE_TYPENAMES
8533  .memberName = "methodsToCall",
8534 #endif
8535  .namespaceZero = true,
8536  .padding = offsetof(UA_CallRequest, methodsToCallSize) - offsetof(UA_CallRequest, requestHeader) - sizeof(UA_RequestHeader),
8537  .isArray = true
8538  },};
8539 
8540 /* MethodAttributes */
8541 static UA_DataTypeMember MethodAttributes_members[7] = {
8543 #ifdef UA_ENABLE_TYPENAMES
8544  .memberName = "specifiedAttributes",
8545 #endif
8546  .namespaceZero = true,
8547  .padding = 0,
8548  .isArray = false
8549  },
8550  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8551 #ifdef UA_ENABLE_TYPENAMES
8552  .memberName = "displayName",
8553 #endif
8554  .namespaceZero = true,
8555  .padding = offsetof(UA_MethodAttributes, displayName) - offsetof(UA_MethodAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8556  .isArray = false
8557  },
8558  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8559 #ifdef UA_ENABLE_TYPENAMES
8560  .memberName = "description",
8561 #endif
8562  .namespaceZero = true,
8563  .padding = offsetof(UA_MethodAttributes, description) - offsetof(UA_MethodAttributes, displayName) - sizeof(UA_LocalizedText),
8564  .isArray = false
8565  },
8566  { .memberTypeIndex = UA_TYPES_UINT32,
8567 #ifdef UA_ENABLE_TYPENAMES
8568  .memberName = "writeMask",
8569 #endif
8570  .namespaceZero = true,
8571  .padding = offsetof(UA_MethodAttributes, writeMask) - offsetof(UA_MethodAttributes, description) - sizeof(UA_LocalizedText),
8572  .isArray = false
8573  },
8574  { .memberTypeIndex = UA_TYPES_UINT32,
8575 #ifdef UA_ENABLE_TYPENAMES
8576  .memberName = "userWriteMask",
8577 #endif
8578  .namespaceZero = true,
8579  .padding = offsetof(UA_MethodAttributes, userWriteMask) - offsetof(UA_MethodAttributes, writeMask) - sizeof(UA_UInt32),
8580  .isArray = false
8581  },
8582  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8583 #ifdef UA_ENABLE_TYPENAMES
8584  .memberName = "executable",
8585 #endif
8586  .namespaceZero = true,
8587  .padding = offsetof(UA_MethodAttributes, executable) - offsetof(UA_MethodAttributes, userWriteMask) - sizeof(UA_UInt32),
8588  .isArray = false
8589  },
8590  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8591 #ifdef UA_ENABLE_TYPENAMES
8592  .memberName = "userExecutable",
8593 #endif
8594  .namespaceZero = true,
8595  .padding = offsetof(UA_MethodAttributes, userExecutable) - offsetof(UA_MethodAttributes, executable) - sizeof(UA_Boolean),
8596  .isArray = false
8597  },};
8598 
8599 /* DeleteReferencesItem */
8600 static UA_DataTypeMember DeleteReferencesItem_members[5] = {
8602 #ifdef UA_ENABLE_TYPENAMES
8603  .memberName = "sourceNodeId",
8604 #endif
8605  .namespaceZero = true,
8606  .padding = 0,
8607  .isArray = false
8608  },
8609  { .memberTypeIndex = UA_TYPES_NODEID,
8610 #ifdef UA_ENABLE_TYPENAMES
8611  .memberName = "referenceTypeId",
8612 #endif
8613  .namespaceZero = true,
8614  .padding = offsetof(UA_DeleteReferencesItem, referenceTypeId) - offsetof(UA_DeleteReferencesItem, sourceNodeId) - sizeof(UA_NodeId),
8615  .isArray = false
8616  },
8617  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8618 #ifdef UA_ENABLE_TYPENAMES
8619  .memberName = "isForward",
8620 #endif
8621  .namespaceZero = true,
8622  .padding = offsetof(UA_DeleteReferencesItem, isForward) - offsetof(UA_DeleteReferencesItem, referenceTypeId) - sizeof(UA_NodeId),
8623  .isArray = false
8624  },
8625  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8626 #ifdef UA_ENABLE_TYPENAMES
8627  .memberName = "targetNodeId",
8628 #endif
8629  .namespaceZero = true,
8630  .padding = offsetof(UA_DeleteReferencesItem, targetNodeId) - offsetof(UA_DeleteReferencesItem, isForward) - sizeof(UA_Boolean),
8631  .isArray = false
8632  },
8633  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8634 #ifdef UA_ENABLE_TYPENAMES
8635  .memberName = "deleteBidirectional",
8636 #endif
8637  .namespaceZero = true,
8638  .padding = offsetof(UA_DeleteReferencesItem, deleteBidirectional) - offsetof(UA_DeleteReferencesItem, targetNodeId) - sizeof(UA_ExpandedNodeId),
8639  .isArray = false
8640  },};
8641 
8642 /* WriteValue */
8643 static UA_DataTypeMember WriteValue_members[4] = {
8645 #ifdef UA_ENABLE_TYPENAMES
8646  .memberName = "nodeId",
8647 #endif
8648  .namespaceZero = true,
8649  .padding = 0,
8650  .isArray = false
8651  },
8652  { .memberTypeIndex = UA_TYPES_UINT32,
8653 #ifdef UA_ENABLE_TYPENAMES
8654  .memberName = "attributeId",
8655 #endif
8656  .namespaceZero = true,
8657  .padding = offsetof(UA_WriteValue, attributeId) - offsetof(UA_WriteValue, nodeId) - sizeof(UA_NodeId),
8658  .isArray = false
8659  },
8660  { .memberTypeIndex = UA_TYPES_STRING,
8661 #ifdef UA_ENABLE_TYPENAMES
8662  .memberName = "indexRange",
8663 #endif
8664  .namespaceZero = true,
8665  .padding = offsetof(UA_WriteValue, indexRange) - offsetof(UA_WriteValue, attributeId) - sizeof(UA_UInt32),
8666  .isArray = false
8667  },
8668  { .memberTypeIndex = UA_TYPES_DATAVALUE,
8669 #ifdef UA_ENABLE_TYPENAMES
8670  .memberName = "value",
8671 #endif
8672  .namespaceZero = true,
8673  .padding = offsetof(UA_WriteValue, value) - offsetof(UA_WriteValue, indexRange) - sizeof(UA_String),
8674  .isArray = false
8675  },};
8676 
8677 /* MonitoredItemCreateResult */
8678 static UA_DataTypeMember MonitoredItemCreateResult_members[5] = {
8680 #ifdef UA_ENABLE_TYPENAMES
8681  .memberName = "statusCode",
8682 #endif
8683  .namespaceZero = true,
8684  .padding = 0,
8685  .isArray = false
8686  },
8687  { .memberTypeIndex = UA_TYPES_UINT32,
8688 #ifdef UA_ENABLE_TYPENAMES
8689  .memberName = "monitoredItemId",
8690 #endif
8691  .namespaceZero = true,
8692  .padding = offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - offsetof(UA_MonitoredItemCreateResult, statusCode) - sizeof(UA_StatusCode),
8693  .isArray = false
8694  },
8695  { .memberTypeIndex = UA_TYPES_DOUBLE,
8696 #ifdef UA_ENABLE_TYPENAMES
8697  .memberName = "revisedSamplingInterval",
8698 #endif
8699  .namespaceZero = true,
8700  .padding = offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - sizeof(UA_UInt32),
8701  .isArray = false
8702  },
8703  { .memberTypeIndex = UA_TYPES_UINT32,
8704 #ifdef UA_ENABLE_TYPENAMES
8705  .memberName = "revisedQueueSize",
8706 #endif
8707  .namespaceZero = true,
8708  .padding = offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - sizeof(UA_Double),
8709  .isArray = false
8710  },
8711  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8712 #ifdef UA_ENABLE_TYPENAMES
8713  .memberName = "filterResult",
8714 #endif
8715  .namespaceZero = true,
8716  .padding = offsetof(UA_MonitoredItemCreateResult, filterResult) - offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - sizeof(UA_UInt32),
8717  .isArray = false
8718  },};
8719 
8720 /* MessageSecurityMode */
8721 static UA_DataTypeMember MessageSecurityMode_members[1] = {
8723 #ifdef UA_ENABLE_TYPENAMES
8724  .memberName = "",
8725 #endif
8726  .namespaceZero = true,
8727  .padding = 0,
8728  .isArray = false
8729  },};
8730 
8731 /* MonitoringParameters */
8732 static UA_DataTypeMember MonitoringParameters_members[5] = {
8734 #ifdef UA_ENABLE_TYPENAMES
8735  .memberName = "clientHandle",
8736 #endif
8737  .namespaceZero = true,
8738  .padding = 0,
8739  .isArray = false
8740  },
8741  { .memberTypeIndex = UA_TYPES_DOUBLE,
8742 #ifdef UA_ENABLE_TYPENAMES
8743  .memberName = "samplingInterval",
8744 #endif
8745  .namespaceZero = true,
8746  .padding = offsetof(UA_MonitoringParameters, samplingInterval) - offsetof(UA_MonitoringParameters, clientHandle) - sizeof(UA_UInt32),
8747  .isArray = false
8748  },
8749  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8750 #ifdef UA_ENABLE_TYPENAMES
8751  .memberName = "filter",
8752 #endif
8753  .namespaceZero = true,
8754  .padding = offsetof(UA_MonitoringParameters, filter) - offsetof(UA_MonitoringParameters, samplingInterval) - sizeof(UA_Double),
8755  .isArray = false
8756  },
8757  { .memberTypeIndex = UA_TYPES_UINT32,
8758 #ifdef UA_ENABLE_TYPENAMES
8759  .memberName = "queueSize",
8760 #endif
8761  .namespaceZero = true,
8762  .padding = offsetof(UA_MonitoringParameters, queueSize) - offsetof(UA_MonitoringParameters, filter) - sizeof(UA_ExtensionObject),
8763  .isArray = false
8764  },
8765  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8766 #ifdef UA_ENABLE_TYPENAMES
8767  .memberName = "discardOldest",
8768 #endif
8769  .namespaceZero = true,
8770  .padding = offsetof(UA_MonitoringParameters, discardOldest) - offsetof(UA_MonitoringParameters, queueSize) - sizeof(UA_UInt32),
8771  .isArray = false
8772  },};
8773 
8774 /* SignatureData */
8775 static UA_DataTypeMember SignatureData_members[2] = {
8777 #ifdef UA_ENABLE_TYPENAMES
8778  .memberName = "algorithm",
8779 #endif
8780  .namespaceZero = true,
8781  .padding = 0,
8782  .isArray = false
8783  },
8784  { .memberTypeIndex = UA_TYPES_BYTESTRING,
8785 #ifdef UA_ENABLE_TYPENAMES
8786  .memberName = "signature",
8787 #endif
8788  .namespaceZero = true,
8789  .padding = offsetof(UA_SignatureData, signature) - offsetof(UA_SignatureData, algorithm) - sizeof(UA_String),
8790  .isArray = false
8791  },};
8792 
8793 /* ReferenceNode */
8794 static UA_DataTypeMember ReferenceNode_members[3] = {
8796 #ifdef UA_ENABLE_TYPENAMES
8797  .memberName = "referenceTypeId",
8798 #endif
8799  .namespaceZero = true,
8800  .padding = 0,
8801  .isArray = false
8802  },
8803  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8804 #ifdef UA_ENABLE_TYPENAMES
8805  .memberName = "isInverse",
8806 #endif
8807  .namespaceZero = true,
8808  .padding = offsetof(UA_ReferenceNode, isInverse) - offsetof(UA_ReferenceNode, referenceTypeId) - sizeof(UA_NodeId),
8809  .isArray = false
8810  },
8811  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8812 #ifdef UA_ENABLE_TYPENAMES
8813  .memberName = "targetId",
8814 #endif
8815  .namespaceZero = true,
8816  .padding = offsetof(UA_ReferenceNode, targetId) - offsetof(UA_ReferenceNode, isInverse) - sizeof(UA_Boolean),
8817  .isArray = false
8818  },};
8819 
8820 /* Argument */
8821 static UA_DataTypeMember Argument_members[5] = {
8823 #ifdef UA_ENABLE_TYPENAMES
8824  .memberName = "name",
8825 #endif
8826  .namespaceZero = true,
8827  .padding = 0,
8828  .isArray = false
8829  },
8830  { .memberTypeIndex = UA_TYPES_NODEID,
8831 #ifdef UA_ENABLE_TYPENAMES
8832  .memberName = "dataType",
8833 #endif
8834  .namespaceZero = true,
8835  .padding = offsetof(UA_Argument, dataType) - offsetof(UA_Argument, name) - sizeof(UA_String),
8836  .isArray = false
8837  },
8838  { .memberTypeIndex = UA_TYPES_INT32,
8839 #ifdef UA_ENABLE_TYPENAMES
8840  .memberName = "valueRank",
8841 #endif
8842  .namespaceZero = true,
8843  .padding = offsetof(UA_Argument, valueRank) - offsetof(UA_Argument, dataType) - sizeof(UA_NodeId),
8844  .isArray = false
8845  },
8846  { .memberTypeIndex = UA_TYPES_UINT32,
8847 #ifdef UA_ENABLE_TYPENAMES
8848  .memberName = "arrayDimensions",
8849 #endif
8850  .namespaceZero = true,
8851  .padding = offsetof(UA_Argument, arrayDimensionsSize) - offsetof(UA_Argument, valueRank) - sizeof(UA_Int32),
8852  .isArray = true
8853  },
8854  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8855 #ifdef UA_ENABLE_TYPENAMES
8856  .memberName = "description",
8857 #endif
8858  .namespaceZero = true,
8859  .padding = offsetof(UA_Argument, description) - offsetof(UA_Argument, arrayDimensions) - sizeof(void*),
8860  .isArray = false
8861  },};
8862 
8863 /* UserIdentityToken */
8864 static UA_DataTypeMember UserIdentityToken_members[1] = {
8866 #ifdef UA_ENABLE_TYPENAMES
8867  .memberName = "policyId",
8868 #endif
8869  .namespaceZero = true,
8870  .padding = 0,
8871  .isArray = false
8872  },};
8873 
8874 /* ObjectTypeAttributes */
8875 static UA_DataTypeMember ObjectTypeAttributes_members[6] = {
8877 #ifdef UA_ENABLE_TYPENAMES
8878  .memberName = "specifiedAttributes",
8879 #endif
8880  .namespaceZero = true,
8881  .padding = 0,
8882  .isArray = false
8883  },
8884  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8885 #ifdef UA_ENABLE_TYPENAMES
8886  .memberName = "displayName",
8887 #endif
8888  .namespaceZero = true,
8889  .padding = offsetof(UA_ObjectTypeAttributes, displayName) - offsetof(UA_ObjectTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8890  .isArray = false
8891  },
8892  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8893 #ifdef UA_ENABLE_TYPENAMES
8894  .memberName = "description",
8895 #endif
8896  .namespaceZero = true,
8897  .padding = offsetof(UA_ObjectTypeAttributes, description) - offsetof(UA_ObjectTypeAttributes, displayName) - sizeof(UA_LocalizedText),
8898  .isArray = false
8899  },
8900  { .memberTypeIndex = UA_TYPES_UINT32,
8901 #ifdef UA_ENABLE_TYPENAMES
8902  .memberName = "writeMask",
8903 #endif
8904  .namespaceZero = true,
8905  .padding = offsetof(UA_ObjectTypeAttributes, writeMask) - offsetof(UA_ObjectTypeAttributes, description) - sizeof(UA_LocalizedText),
8906  .isArray = false
8907  },
8908  { .memberTypeIndex = UA_TYPES_UINT32,
8909 #ifdef UA_ENABLE_TYPENAMES
8910  .memberName = "userWriteMask",
8911 #endif
8912  .namespaceZero = true,
8913  .padding = offsetof(UA_ObjectTypeAttributes, userWriteMask) - offsetof(UA_ObjectTypeAttributes, writeMask) - sizeof(UA_UInt32),
8914  .isArray = false
8915  },
8916  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8917 #ifdef UA_ENABLE_TYPENAMES
8918  .memberName = "isAbstract",
8919 #endif
8920  .namespaceZero = true,
8921  .padding = offsetof(UA_ObjectTypeAttributes, isAbstract) - offsetof(UA_ObjectTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
8922  .isArray = false
8923  },};
8924 
8925 /* DeadbandType */
8926 static UA_DataTypeMember DeadbandType_members[1] = {
8928 #ifdef UA_ENABLE_TYPENAMES
8929  .memberName = "",
8930 #endif
8931  .namespaceZero = true,
8932  .padding = 0,
8933  .isArray = false
8934  },};
8935 
8936 /* SecurityTokenRequestType */
8937 static UA_DataTypeMember SecurityTokenRequestType_members[1] = {
8939 #ifdef UA_ENABLE_TYPENAMES
8940  .memberName = "",
8941 #endif
8942  .namespaceZero = true,
8943  .padding = 0,
8944  .isArray = false
8945  },};
8946 
8947 /* DataChangeTrigger */
8948 static UA_DataTypeMember DataChangeTrigger_members[1] = {
8950 #ifdef UA_ENABLE_TYPENAMES
8951  .memberName = "",
8952 #endif
8953  .namespaceZero = true,
8954  .padding = 0,
8955  .isArray = false
8956  },};
8957 
8958 /* BuildInfo */
8959 static UA_DataTypeMember BuildInfo_members[6] = {
8961 #ifdef UA_ENABLE_TYPENAMES
8962  .memberName = "productUri",
8963 #endif
8964  .namespaceZero = true,
8965  .padding = 0,
8966  .isArray = false
8967  },
8968  { .memberTypeIndex = UA_TYPES_STRING,
8969 #ifdef UA_ENABLE_TYPENAMES
8970  .memberName = "manufacturerName",
8971 #endif
8972  .namespaceZero = true,
8973  .padding = offsetof(UA_BuildInfo, manufacturerName) - offsetof(UA_BuildInfo, productUri) - sizeof(UA_String),
8974  .isArray = false
8975  },
8976  { .memberTypeIndex = UA_TYPES_STRING,
8977 #ifdef UA_ENABLE_TYPENAMES
8978  .memberName = "productName",
8979 #endif
8980  .namespaceZero = true,
8981  .padding = offsetof(UA_BuildInfo, productName) - offsetof(UA_BuildInfo, manufacturerName) - sizeof(UA_String),
8982  .isArray = false
8983  },
8984  { .memberTypeIndex = UA_TYPES_STRING,
8985 #ifdef UA_ENABLE_TYPENAMES
8986  .memberName = "softwareVersion",
8987 #endif
8988  .namespaceZero = true,
8989  .padding = offsetof(UA_BuildInfo, softwareVersion) - offsetof(UA_BuildInfo, productName) - sizeof(UA_String),
8990  .isArray = false
8991  },
8992  { .memberTypeIndex = UA_TYPES_STRING,
8993 #ifdef UA_ENABLE_TYPENAMES
8994  .memberName = "buildNumber",
8995 #endif
8996  .namespaceZero = true,
8997  .padding = offsetof(UA_BuildInfo, buildNumber) - offsetof(UA_BuildInfo, softwareVersion) - sizeof(UA_String),
8998  .isArray = false
8999  },
9000  { .memberTypeIndex = UA_TYPES_DATETIME,
9001 #ifdef UA_ENABLE_TYPENAMES
9002  .memberName = "buildDate",
9003 #endif
9004  .namespaceZero = true,
9005  .padding = offsetof(UA_BuildInfo, buildDate) - offsetof(UA_BuildInfo, buildNumber) - sizeof(UA_String),
9006  .isArray = false
9007  },};
9008 
9009 /* NodeClass */
9010 static UA_DataTypeMember NodeClass_members[1] = {
9012 #ifdef UA_ENABLE_TYPENAMES
9013  .memberName = "",
9014 #endif
9015  .namespaceZero = true,
9016  .padding = 0,
9017  .isArray = false
9018  },};
9019 
9020 /* ChannelSecurityToken */
9021 static UA_DataTypeMember ChannelSecurityToken_members[4] = {
9023 #ifdef UA_ENABLE_TYPENAMES
9024  .memberName = "channelId",
9025 #endif
9026  .namespaceZero = true,
9027  .padding = 0,
9028  .isArray = false
9029  },
9030  { .memberTypeIndex = UA_TYPES_UINT32,
9031 #ifdef UA_ENABLE_TYPENAMES
9032  .memberName = "tokenId",
9033 #endif
9034  .namespaceZero = true,
9035  .padding = offsetof(UA_ChannelSecurityToken, tokenId) - offsetof(UA_ChannelSecurityToken, channelId) - sizeof(UA_UInt32),
9036  .isArray = false
9037  },
9038  { .memberTypeIndex = UA_TYPES_DATETIME,
9039 #ifdef UA_ENABLE_TYPENAMES
9040  .memberName = "createdAt",
9041 #endif
9042  .namespaceZero = true,
9043  .padding = offsetof(UA_ChannelSecurityToken, createdAt) - offsetof(UA_ChannelSecurityToken, tokenId) - sizeof(UA_UInt32),
9044  .isArray = false
9045  },
9046  { .memberTypeIndex = UA_TYPES_UINT32,
9047 #ifdef UA_ENABLE_TYPENAMES
9048  .memberName = "revisedLifetime",
9049 #endif
9050  .namespaceZero = true,
9051  .padding = offsetof(UA_ChannelSecurityToken, revisedLifetime) - offsetof(UA_ChannelSecurityToken, createdAt) - sizeof(UA_DateTime),
9052  .isArray = false
9053  },};
9054 
9055 /* MonitoredItemNotification */
9056 static UA_DataTypeMember MonitoredItemNotification_members[2] = {
9058 #ifdef UA_ENABLE_TYPENAMES
9059  .memberName = "clientHandle",
9060 #endif
9061  .namespaceZero = true,
9062  .padding = 0,
9063  .isArray = false
9064  },
9065  { .memberTypeIndex = UA_TYPES_DATAVALUE,
9066 #ifdef UA_ENABLE_TYPENAMES
9067  .memberName = "value",
9068 #endif
9069  .namespaceZero = true,
9070  .padding = offsetof(UA_MonitoredItemNotification, value) - offsetof(UA_MonitoredItemNotification, clientHandle) - sizeof(UA_UInt32),
9071  .isArray = false
9072  },};
9073 
9074 /* DeleteNodesItem */
9075 static UA_DataTypeMember DeleteNodesItem_members[2] = {
9077 #ifdef UA_ENABLE_TYPENAMES
9078  .memberName = "nodeId",
9079 #endif
9080  .namespaceZero = true,
9081  .padding = 0,
9082  .isArray = false
9083  },
9084  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9085 #ifdef UA_ENABLE_TYPENAMES
9086  .memberName = "deleteTargetReferences",
9087 #endif
9088  .namespaceZero = true,
9089  .padding = offsetof(UA_DeleteNodesItem, deleteTargetReferences) - offsetof(UA_DeleteNodesItem, nodeId) - sizeof(UA_NodeId),
9090  .isArray = false
9091  },};
9092 
9093 /* SubscriptionAcknowledgement */
9094 static UA_DataTypeMember SubscriptionAcknowledgement_members[2] = {
9096 #ifdef UA_ENABLE_TYPENAMES
9097  .memberName = "subscriptionId",
9098 #endif
9099  .namespaceZero = true,
9100  .padding = 0,
9101  .isArray = false
9102  },
9103  { .memberTypeIndex = UA_TYPES_UINT32,
9104 #ifdef UA_ENABLE_TYPENAMES
9105  .memberName = "sequenceNumber",
9106 #endif
9107  .namespaceZero = true,
9108  .padding = offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) - offsetof(UA_SubscriptionAcknowledgement, subscriptionId) - sizeof(UA_UInt32),
9109  .isArray = false
9110  },};
9111 
9112 /* ReadValueId */
9113 static UA_DataTypeMember ReadValueId_members[4] = {
9115 #ifdef UA_ENABLE_TYPENAMES
9116  .memberName = "nodeId",
9117 #endif
9118  .namespaceZero = true,
9119  .padding = 0,
9120  .isArray = false
9121  },
9122  { .memberTypeIndex = UA_TYPES_UINT32,
9123 #ifdef UA_ENABLE_TYPENAMES
9124  .memberName = "attributeId",
9125 #endif
9126  .namespaceZero = true,
9127  .padding = offsetof(UA_ReadValueId, attributeId) - offsetof(UA_ReadValueId, nodeId) - sizeof(UA_NodeId),
9128  .isArray = false
9129  },
9130  { .memberTypeIndex = UA_TYPES_STRING,
9131 #ifdef UA_ENABLE_TYPENAMES
9132  .memberName = "indexRange",
9133 #endif
9134  .namespaceZero = true,
9135  .padding = offsetof(UA_ReadValueId, indexRange) - offsetof(UA_ReadValueId, attributeId) - sizeof(UA_UInt32),
9136  .isArray = false
9137  },
9138  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
9139 #ifdef UA_ENABLE_TYPENAMES
9140  .memberName = "dataEncoding",
9141 #endif
9142  .namespaceZero = true,
9143  .padding = offsetof(UA_ReadValueId, dataEncoding) - offsetof(UA_ReadValueId, indexRange) - sizeof(UA_String),
9144  .isArray = false
9145  },};
9146 
9147 /* DataTypeAttributes */
9148 static UA_DataTypeMember DataTypeAttributes_members[6] = {
9150 #ifdef UA_ENABLE_TYPENAMES
9151  .memberName = "specifiedAttributes",
9152 #endif
9153  .namespaceZero = true,
9154  .padding = 0,
9155  .isArray = false
9156  },
9157  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9158 #ifdef UA_ENABLE_TYPENAMES
9159  .memberName = "displayName",
9160 #endif
9161  .namespaceZero = true,
9162  .padding = offsetof(UA_DataTypeAttributes, displayName) - offsetof(UA_DataTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9163  .isArray = false
9164  },
9165  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9166 #ifdef UA_ENABLE_TYPENAMES
9167  .memberName = "description",
9168 #endif
9169  .namespaceZero = true,
9170  .padding = offsetof(UA_DataTypeAttributes, description) - offsetof(UA_DataTypeAttributes, displayName) - sizeof(UA_LocalizedText),
9171  .isArray = false
9172  },
9173  { .memberTypeIndex = UA_TYPES_UINT32,
9174 #ifdef UA_ENABLE_TYPENAMES
9175  .memberName = "writeMask",
9176 #endif
9177  .namespaceZero = true,
9178  .padding = offsetof(UA_DataTypeAttributes, writeMask) - offsetof(UA_DataTypeAttributes, description) - sizeof(UA_LocalizedText),
9179  .isArray = false
9180  },
9181  { .memberTypeIndex = UA_TYPES_UINT32,
9182 #ifdef UA_ENABLE_TYPENAMES
9183  .memberName = "userWriteMask",
9184 #endif
9185  .namespaceZero = true,
9186  .padding = offsetof(UA_DataTypeAttributes, userWriteMask) - offsetof(UA_DataTypeAttributes, writeMask) - sizeof(UA_UInt32),
9187  .isArray = false
9188  },
9189  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9190 #ifdef UA_ENABLE_TYPENAMES
9191  .memberName = "isAbstract",
9192 #endif
9193  .namespaceZero = true,
9194  .padding = offsetof(UA_DataTypeAttributes, isAbstract) - offsetof(UA_DataTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
9195  .isArray = false
9196  },};
9197 
9198 /* ResponseHeader */
9199 static UA_DataTypeMember ResponseHeader_members[6] = {
9201 #ifdef UA_ENABLE_TYPENAMES
9202  .memberName = "timestamp",
9203 #endif
9204  .namespaceZero = true,
9205  .padding = 0,
9206  .isArray = false
9207  },
9208  { .memberTypeIndex = UA_TYPES_UINT32,
9209 #ifdef UA_ENABLE_TYPENAMES
9210  .memberName = "requestHandle",
9211 #endif
9212  .namespaceZero = true,
9213  .padding = offsetof(UA_ResponseHeader, requestHandle) - offsetof(UA_ResponseHeader, timestamp) - sizeof(UA_DateTime),
9214  .isArray = false
9215  },
9216  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9217 #ifdef UA_ENABLE_TYPENAMES
9218  .memberName = "serviceResult",
9219 #endif
9220  .namespaceZero = true,
9221  .padding = offsetof(UA_ResponseHeader, serviceResult) - offsetof(UA_ResponseHeader, requestHandle) - sizeof(UA_UInt32),
9222  .isArray = false
9223  },
9224  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9225 #ifdef UA_ENABLE_TYPENAMES
9226  .memberName = "serviceDiagnostics",
9227 #endif
9228  .namespaceZero = true,
9229  .padding = offsetof(UA_ResponseHeader, serviceDiagnostics) - offsetof(UA_ResponseHeader, serviceResult) - sizeof(UA_StatusCode),
9230  .isArray = false
9231  },
9232  { .memberTypeIndex = UA_TYPES_STRING,
9233 #ifdef UA_ENABLE_TYPENAMES
9234  .memberName = "stringTable",
9235 #endif
9236  .namespaceZero = true,
9237  .padding = offsetof(UA_ResponseHeader, stringTableSize) - offsetof(UA_ResponseHeader, serviceDiagnostics) - sizeof(UA_DiagnosticInfo),
9238  .isArray = true
9239  },
9240  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
9241 #ifdef UA_ENABLE_TYPENAMES
9242  .memberName = "additionalHeader",
9243 #endif
9244  .namespaceZero = true,
9245  .padding = offsetof(UA_ResponseHeader, additionalHeader) - offsetof(UA_ResponseHeader, stringTable) - sizeof(void*),
9246  .isArray = false
9247  },};
9248 
9249 /* DeleteSubscriptionsRequest */
9250 static UA_DataTypeMember DeleteSubscriptionsRequest_members[2] = {
9252 #ifdef UA_ENABLE_TYPENAMES
9253  .memberName = "requestHeader",
9254 #endif
9255  .namespaceZero = true,
9256  .padding = 0,
9257  .isArray = false
9258  },
9259  { .memberTypeIndex = UA_TYPES_UINT32,
9260 #ifdef UA_ENABLE_TYPENAMES
9261  .memberName = "subscriptionIds",
9262 #endif
9263  .namespaceZero = true,
9264  .padding = offsetof(UA_DeleteSubscriptionsRequest, subscriptionIdsSize) - offsetof(UA_DeleteSubscriptionsRequest, requestHeader) - sizeof(UA_RequestHeader),
9265  .isArray = true
9266  },};
9267 
9268 /* ViewDescription */
9269 static UA_DataTypeMember ViewDescription_members[3] = {
9271 #ifdef UA_ENABLE_TYPENAMES
9272  .memberName = "viewId",
9273 #endif
9274  .namespaceZero = true,
9275  .padding = 0,
9276  .isArray = false
9277  },
9278  { .memberTypeIndex = UA_TYPES_DATETIME,
9279 #ifdef UA_ENABLE_TYPENAMES
9280  .memberName = "timestamp",
9281 #endif
9282  .namespaceZero = true,
9283  .padding = offsetof(UA_ViewDescription, timestamp) - offsetof(UA_ViewDescription, viewId) - sizeof(UA_NodeId),
9284  .isArray = false
9285  },
9286  { .memberTypeIndex = UA_TYPES_UINT32,
9287 #ifdef UA_ENABLE_TYPENAMES
9288  .memberName = "viewVersion",
9289 #endif
9290  .namespaceZero = true,
9291  .padding = offsetof(UA_ViewDescription, viewVersion) - offsetof(UA_ViewDescription, timestamp) - sizeof(UA_DateTime),
9292  .isArray = false
9293  },};
9294 
9295 /* DeleteMonitoredItemsResponse */
9296 static UA_DataTypeMember DeleteMonitoredItemsResponse_members[3] = {
9298 #ifdef UA_ENABLE_TYPENAMES
9299  .memberName = "responseHeader",
9300 #endif
9301  .namespaceZero = true,
9302  .padding = 0,
9303  .isArray = false
9304  },
9305  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9306 #ifdef UA_ENABLE_TYPENAMES
9307  .memberName = "results",
9308 #endif
9309  .namespaceZero = true,
9310  .padding = offsetof(UA_DeleteMonitoredItemsResponse, resultsSize) - offsetof(UA_DeleteMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
9311  .isArray = true
9312  },
9313  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9314 #ifdef UA_ENABLE_TYPENAMES
9315  .memberName = "diagnosticInfos",
9316 #endif
9317  .namespaceZero = true,
9318  .padding = offsetof(UA_DeleteMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_DeleteMonitoredItemsResponse, results) - sizeof(void*),
9319  .isArray = true
9320  },};
9321 
9322 /* NodeAttributes */
9323 static UA_DataTypeMember NodeAttributes_members[5] = {
9325 #ifdef UA_ENABLE_TYPENAMES
9326  .memberName = "specifiedAttributes",
9327 #endif
9328  .namespaceZero = true,
9329  .padding = 0,
9330  .isArray = false
9331  },
9332  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9333 #ifdef UA_ENABLE_TYPENAMES
9334  .memberName = "displayName",
9335 #endif
9336  .namespaceZero = true,
9337  .padding = offsetof(UA_NodeAttributes, displayName) - offsetof(UA_NodeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9338  .isArray = false
9339  },
9340  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9341 #ifdef UA_ENABLE_TYPENAMES
9342  .memberName = "description",
9343 #endif
9344  .namespaceZero = true,
9345  .padding = offsetof(UA_NodeAttributes, description) - offsetof(UA_NodeAttributes, displayName) - sizeof(UA_LocalizedText),
9346  .isArray = false
9347  },
9348  { .memberTypeIndex = UA_TYPES_UINT32,
9349 #ifdef UA_ENABLE_TYPENAMES
9350  .memberName = "writeMask",
9351 #endif
9352  .namespaceZero = true,
9353  .padding = offsetof(UA_NodeAttributes, writeMask) - offsetof(UA_NodeAttributes, description) - sizeof(UA_LocalizedText),
9354  .isArray = false
9355  },
9356  { .memberTypeIndex = UA_TYPES_UINT32,
9357 #ifdef UA_ENABLE_TYPENAMES
9358  .memberName = "userWriteMask",
9359 #endif
9360  .namespaceZero = true,
9361  .padding = offsetof(UA_NodeAttributes, userWriteMask) - offsetof(UA_NodeAttributes, writeMask) - sizeof(UA_UInt32),
9362  .isArray = false
9363  },};
9364 
9365 /* RegisterNodesRequest */
9366 static UA_DataTypeMember RegisterNodesRequest_members[2] = {
9368 #ifdef UA_ENABLE_TYPENAMES
9369  .memberName = "requestHeader",
9370 #endif
9371  .namespaceZero = true,
9372  .padding = 0,
9373  .isArray = false
9374  },
9375  { .memberTypeIndex = UA_TYPES_NODEID,
9376 #ifdef UA_ENABLE_TYPENAMES
9377  .memberName = "nodesToRegister",
9378 #endif
9379  .namespaceZero = true,
9380  .padding = offsetof(UA_RegisterNodesRequest, nodesToRegisterSize) - offsetof(UA_RegisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
9381  .isArray = true
9382  },};
9383 
9384 /* DeleteNodesRequest */
9385 static UA_DataTypeMember DeleteNodesRequest_members[2] = {
9387 #ifdef UA_ENABLE_TYPENAMES
9388  .memberName = "requestHeader",
9389 #endif
9390  .namespaceZero = true,
9391  .padding = 0,
9392  .isArray = false
9393  },
9394  { .memberTypeIndex = UA_TYPES_DELETENODESITEM,
9395 #ifdef UA_ENABLE_TYPENAMES
9396  .memberName = "nodesToDelete",
9397 #endif
9398  .namespaceZero = true,
9399  .padding = offsetof(UA_DeleteNodesRequest, nodesToDeleteSize) - offsetof(UA_DeleteNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
9400  .isArray = true
9401  },};
9402 
9403 /* PublishResponse */
9404 static UA_DataTypeMember PublishResponse_members[7] = {
9406 #ifdef UA_ENABLE_TYPENAMES
9407  .memberName = "responseHeader",
9408 #endif
9409  .namespaceZero = true,
9410  .padding = 0,
9411  .isArray = false
9412  },
9413  { .memberTypeIndex = UA_TYPES_UINT32,
9414 #ifdef UA_ENABLE_TYPENAMES
9415  .memberName = "subscriptionId",
9416 #endif
9417  .namespaceZero = true,
9418  .padding = offsetof(UA_PublishResponse, subscriptionId) - offsetof(UA_PublishResponse, responseHeader) - sizeof(UA_ResponseHeader),
9419  .isArray = false
9420  },
9421  { .memberTypeIndex = UA_TYPES_UINT32,
9422 #ifdef UA_ENABLE_TYPENAMES
9423  .memberName = "availableSequenceNumbers",
9424 #endif
9425  .namespaceZero = true,
9426  .padding = offsetof(UA_PublishResponse, availableSequenceNumbersSize) - offsetof(UA_PublishResponse, subscriptionId) - sizeof(UA_UInt32),
9427  .isArray = true
9428  },
9429  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9430 #ifdef UA_ENABLE_TYPENAMES
9431  .memberName = "moreNotifications",
9432 #endif
9433  .namespaceZero = true,
9434  .padding = offsetof(UA_PublishResponse, moreNotifications) - offsetof(UA_PublishResponse, availableSequenceNumbers) - sizeof(void*),
9435  .isArray = false
9436  },
9437  { .memberTypeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
9438 #ifdef UA_ENABLE_TYPENAMES
9439  .memberName = "notificationMessage",
9440 #endif
9441  .namespaceZero = true,
9442  .padding = offsetof(UA_PublishResponse, notificationMessage) - offsetof(UA_PublishResponse, moreNotifications) - sizeof(UA_Boolean),
9443  .isArray = false
9444  },
9445  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9446 #ifdef UA_ENABLE_TYPENAMES
9447  .memberName = "results",
9448 #endif
9449  .namespaceZero = true,
9450  .padding = offsetof(UA_PublishResponse, resultsSize) - offsetof(UA_PublishResponse, notificationMessage) - sizeof(UA_NotificationMessage),
9451  .isArray = true
9452  },
9453  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9454 #ifdef UA_ENABLE_TYPENAMES
9455  .memberName = "diagnosticInfos",
9456 #endif
9457  .namespaceZero = true,
9458  .padding = offsetof(UA_PublishResponse, diagnosticInfosSize) - offsetof(UA_PublishResponse, results) - sizeof(void*),
9459  .isArray = true
9460  },};
9461 
9462 /* MonitoredItemModifyRequest */
9463 static UA_DataTypeMember MonitoredItemModifyRequest_members[2] = {
9465 #ifdef UA_ENABLE_TYPENAMES
9466  .memberName = "monitoredItemId",
9467 #endif
9468  .namespaceZero = true,
9469  .padding = 0,
9470  .isArray = false
9471  },
9472  { .memberTypeIndex = UA_TYPES_MONITORINGPARAMETERS,
9473 #ifdef UA_ENABLE_TYPENAMES
9474  .memberName = "requestedParameters",
9475 #endif
9476  .namespaceZero = true,
9477  .padding = offsetof(UA_MonitoredItemModifyRequest, requestedParameters) - offsetof(UA_MonitoredItemModifyRequest, monitoredItemId) - sizeof(UA_UInt32),
9478  .isArray = false
9479  },};
9480 
9481 /* UserNameIdentityToken */
9482 static UA_DataTypeMember UserNameIdentityToken_members[4] = {
9484 #ifdef UA_ENABLE_TYPENAMES
9485  .memberName = "policyId",
9486 #endif
9487  .namespaceZero = true,
9488  .padding = 0,
9489  .isArray = false
9490  },
9491  { .memberTypeIndex = UA_TYPES_STRING,
9492 #ifdef UA_ENABLE_TYPENAMES
9493  .memberName = "userName",
9494 #endif
9495  .namespaceZero = true,
9496  .padding = offsetof(UA_UserNameIdentityToken, userName) - offsetof(UA_UserNameIdentityToken, policyId) - sizeof(UA_String),
9497  .isArray = false
9498  },
9499  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9500 #ifdef UA_ENABLE_TYPENAMES
9501  .memberName = "password",
9502 #endif
9503  .namespaceZero = true,
9504  .padding = offsetof(UA_UserNameIdentityToken, password) - offsetof(UA_UserNameIdentityToken, userName) - sizeof(UA_String),
9505  .isArray = false
9506  },
9507  { .memberTypeIndex = UA_TYPES_STRING,
9508 #ifdef UA_ENABLE_TYPENAMES
9509  .memberName = "encryptionAlgorithm",
9510 #endif
9511  .namespaceZero = true,
9512  .padding = offsetof(UA_UserNameIdentityToken, encryptionAlgorithm) - offsetof(UA_UserNameIdentityToken, password) - sizeof(UA_ByteString),
9513  .isArray = false
9514  },};
9515 
9516 /* IdType */
9517 static UA_DataTypeMember IdType_members[1] = {
9519 #ifdef UA_ENABLE_TYPENAMES
9520  .memberName = "",
9521 #endif
9522  .namespaceZero = true,
9523  .padding = 0,
9524  .isArray = false
9525  },};
9526 
9527 /* UserTokenType */
9528 static UA_DataTypeMember UserTokenType_members[1] = {
9530 #ifdef UA_ENABLE_TYPENAMES
9531  .memberName = "",
9532 #endif
9533  .namespaceZero = true,
9534  .padding = 0,
9535  .isArray = false
9536  },};
9537 
9538 /* ActivateSessionRequest */
9539 static UA_DataTypeMember ActivateSessionRequest_members[6] = {
9541 #ifdef UA_ENABLE_TYPENAMES
9542  .memberName = "requestHeader",
9543 #endif
9544  .namespaceZero = true,
9545  .padding = 0,
9546  .isArray = false
9547  },
9548  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
9549 #ifdef UA_ENABLE_TYPENAMES
9550  .memberName = "clientSignature",
9551 #endif
9552  .namespaceZero = true,
9553  .padding = offsetof(UA_ActivateSessionRequest, clientSignature) - offsetof(UA_ActivateSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
9554  .isArray = false
9555  },
9556  { .memberTypeIndex = UA_TYPES_SIGNEDSOFTWARECERTIFICATE,
9557 #ifdef UA_ENABLE_TYPENAMES
9558  .memberName = "clientSoftwareCertificates",
9559 #endif
9560  .namespaceZero = true,
9561  .padding = offsetof(UA_ActivateSessionRequest, clientSoftwareCertificatesSize) - offsetof(UA_ActivateSessionRequest, clientSignature) - sizeof(UA_SignatureData),
9562  .isArray = true
9563  },
9564  { .memberTypeIndex = UA_TYPES_STRING,
9565 #ifdef UA_ENABLE_TYPENAMES
9566  .memberName = "localeIds",
9567 #endif
9568  .namespaceZero = true,
9569  .padding = offsetof(UA_ActivateSessionRequest, localeIdsSize) - offsetof(UA_ActivateSessionRequest, clientSoftwareCertificates) - sizeof(void*),
9570  .isArray = true
9571  },
9572  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
9573 #ifdef UA_ENABLE_TYPENAMES
9574  .memberName = "userIdentityToken",
9575 #endif
9576  .namespaceZero = true,
9577  .padding = offsetof(UA_ActivateSessionRequest, userIdentityToken) - offsetof(UA_ActivateSessionRequest, localeIds) - sizeof(void*),
9578  .isArray = false
9579  },
9580  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
9581 #ifdef UA_ENABLE_TYPENAMES
9582  .memberName = "userTokenSignature",
9583 #endif
9584  .namespaceZero = true,
9585  .padding = offsetof(UA_ActivateSessionRequest, userTokenSignature) - offsetof(UA_ActivateSessionRequest, userIdentityToken) - sizeof(UA_ExtensionObject),
9586  .isArray = false
9587  },};
9588 
9589 /* OpenSecureChannelResponse */
9590 static UA_DataTypeMember OpenSecureChannelResponse_members[4] = {
9592 #ifdef UA_ENABLE_TYPENAMES
9593  .memberName = "responseHeader",
9594 #endif
9595  .namespaceZero = true,
9596  .padding = 0,
9597  .isArray = false
9598  },
9599  { .memberTypeIndex = UA_TYPES_UINT32,
9600 #ifdef UA_ENABLE_TYPENAMES
9601  .memberName = "serverProtocolVersion",
9602 #endif
9603  .namespaceZero = true,
9604  .padding = offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - offsetof(UA_OpenSecureChannelResponse, responseHeader) - sizeof(UA_ResponseHeader),
9605  .isArray = false
9606  },
9607  { .memberTypeIndex = UA_TYPES_CHANNELSECURITYTOKEN,
9608 #ifdef UA_ENABLE_TYPENAMES
9609  .memberName = "securityToken",
9610 #endif
9611  .namespaceZero = true,
9612  .padding = offsetof(UA_OpenSecureChannelResponse, securityToken) - offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - sizeof(UA_UInt32),
9613  .isArray = false
9614  },
9615  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9616 #ifdef UA_ENABLE_TYPENAMES
9617  .memberName = "serverNonce",
9618 #endif
9619  .namespaceZero = true,
9620  .padding = offsetof(UA_OpenSecureChannelResponse, serverNonce) - offsetof(UA_OpenSecureChannelResponse, securityToken) - sizeof(UA_ChannelSecurityToken),
9621  .isArray = false
9622  },};
9623 
9624 /* ApplicationType */
9625 static UA_DataTypeMember ApplicationType_members[1] = {
9627 #ifdef UA_ENABLE_TYPENAMES
9628  .memberName = "",
9629 #endif
9630  .namespaceZero = true,
9631  .padding = 0,
9632  .isArray = false
9633  },};
9634 
9635 /* ServerState */
9636 static UA_DataTypeMember ServerState_members[1] = {
9638 #ifdef UA_ENABLE_TYPENAMES
9639  .memberName = "",
9640 #endif
9641  .namespaceZero = true,
9642  .padding = 0,
9643  .isArray = false
9644  },};
9645 
9646 /* QueryNextResponse */
9647 static UA_DataTypeMember QueryNextResponse_members[3] = {
9649 #ifdef UA_ENABLE_TYPENAMES
9650  .memberName = "responseHeader",
9651 #endif
9652  .namespaceZero = true,
9653  .padding = 0,
9654  .isArray = false
9655  },
9656  { .memberTypeIndex = UA_TYPES_QUERYDATASET,
9657 #ifdef UA_ENABLE_TYPENAMES
9658  .memberName = "queryDataSets",
9659 #endif
9660  .namespaceZero = true,
9661  .padding = offsetof(UA_QueryNextResponse, queryDataSetsSize) - offsetof(UA_QueryNextResponse, responseHeader) - sizeof(UA_ResponseHeader),
9662  .isArray = true
9663  },
9664  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9665 #ifdef UA_ENABLE_TYPENAMES
9666  .memberName = "revisedContinuationPoint",
9667 #endif
9668  .namespaceZero = true,
9669  .padding = offsetof(UA_QueryNextResponse, revisedContinuationPoint) - offsetof(UA_QueryNextResponse, queryDataSets) - sizeof(void*),
9670  .isArray = false
9671  },};
9672 
9673 /* ActivateSessionResponse */
9674 static UA_DataTypeMember ActivateSessionResponse_members[4] = {
9676 #ifdef UA_ENABLE_TYPENAMES
9677  .memberName = "responseHeader",
9678 #endif
9679  .namespaceZero = true,
9680  .padding = 0,
9681  .isArray = false
9682  },
9683  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9684 #ifdef UA_ENABLE_TYPENAMES
9685  .memberName = "serverNonce",
9686 #endif
9687  .namespaceZero = true,
9688  .padding = offsetof(UA_ActivateSessionResponse, serverNonce) - offsetof(UA_ActivateSessionResponse, responseHeader) - sizeof(UA_ResponseHeader),
9689  .isArray = false
9690  },
9691  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9692 #ifdef UA_ENABLE_TYPENAMES
9693  .memberName = "results",
9694 #endif
9695  .namespaceZero = true,
9696  .padding = offsetof(UA_ActivateSessionResponse, resultsSize) - offsetof(UA_ActivateSessionResponse, serverNonce) - sizeof(UA_ByteString),
9697  .isArray = true
9698  },
9699  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9700 #ifdef UA_ENABLE_TYPENAMES
9701  .memberName = "diagnosticInfos",
9702 #endif
9703  .namespaceZero = true,
9704  .padding = offsetof(UA_ActivateSessionResponse, diagnosticInfosSize) - offsetof(UA_ActivateSessionResponse, results) - sizeof(void*),
9705  .isArray = true
9706  },};
9707 
9708 /* FilterOperator */
9709 static UA_DataTypeMember FilterOperator_members[1] = {
9711 #ifdef UA_ENABLE_TYPENAMES
9712  .memberName = "",
9713 #endif
9714  .namespaceZero = true,
9715  .padding = 0,
9716  .isArray = false
9717  },};
9718 
9719 /* QueryNextRequest */
9720 static UA_DataTypeMember QueryNextRequest_members[3] = {
9722 #ifdef UA_ENABLE_TYPENAMES
9723  .memberName = "requestHeader",
9724 #endif
9725  .namespaceZero = true,
9726  .padding = 0,
9727  .isArray = false
9728  },
9729  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9730 #ifdef UA_ENABLE_TYPENAMES
9731  .memberName = "releaseContinuationPoint",
9732 #endif
9733  .namespaceZero = true,
9734  .padding = offsetof(UA_QueryNextRequest, releaseContinuationPoint) - offsetof(UA_QueryNextRequest, requestHeader) - sizeof(UA_RequestHeader),
9735  .isArray = false
9736  },
9737  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9738 #ifdef UA_ENABLE_TYPENAMES
9739  .memberName = "continuationPoint",
9740 #endif
9741  .namespaceZero = true,
9742  .padding = offsetof(UA_QueryNextRequest, continuationPoint) - offsetof(UA_QueryNextRequest, releaseContinuationPoint) - sizeof(UA_Boolean),
9743  .isArray = false
9744  },};
9745 
9746 /* WriteResponse */
9747 static UA_DataTypeMember WriteResponse_members[3] = {
9749 #ifdef UA_ENABLE_TYPENAMES
9750  .memberName = "responseHeader",
9751 #endif
9752  .namespaceZero = true,
9753  .padding = 0,
9754  .isArray = false
9755  },
9756  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9757 #ifdef UA_ENABLE_TYPENAMES
9758  .memberName = "results",
9759 #endif
9760  .namespaceZero = true,
9761  .padding = offsetof(UA_WriteResponse, resultsSize) - offsetof(UA_WriteResponse, responseHeader) - sizeof(UA_ResponseHeader),
9762  .isArray = true
9763  },
9764  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9765 #ifdef UA_ENABLE_TYPENAMES
9766  .memberName = "diagnosticInfos",
9767 #endif
9768  .namespaceZero = true,
9769  .padding = offsetof(UA_WriteResponse, diagnosticInfosSize) - offsetof(UA_WriteResponse, results) - sizeof(void*),
9770  .isArray = true
9771  },};
9772 
9773 /* BrowseNextRequest */
9774 static UA_DataTypeMember BrowseNextRequest_members[3] = {
9776 #ifdef UA_ENABLE_TYPENAMES
9777  .memberName = "requestHeader",
9778 #endif
9779  .namespaceZero = true,
9780  .padding = 0,
9781  .isArray = false
9782  },
9783  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9784 #ifdef UA_ENABLE_TYPENAMES
9785  .memberName = "releaseContinuationPoints",
9786 #endif
9787  .namespaceZero = true,
9788  .padding = offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - offsetof(UA_BrowseNextRequest, requestHeader) - sizeof(UA_RequestHeader),
9789  .isArray = false
9790  },
9791  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9792 #ifdef UA_ENABLE_TYPENAMES
9793  .memberName = "continuationPoints",
9794 #endif
9795  .namespaceZero = true,
9796  .padding = offsetof(UA_BrowseNextRequest, continuationPointsSize) - offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - sizeof(UA_Boolean),
9797  .isArray = true
9798  },};
9799 
9800 /* CreateSubscriptionRequest */
9801 static UA_DataTypeMember CreateSubscriptionRequest_members[7] = {
9803 #ifdef UA_ENABLE_TYPENAMES
9804  .memberName = "requestHeader",
9805 #endif
9806  .namespaceZero = true,
9807  .padding = 0,
9808  .isArray = false
9809  },
9810  { .memberTypeIndex = UA_TYPES_DOUBLE,
9811 #ifdef UA_ENABLE_TYPENAMES
9812  .memberName = "requestedPublishingInterval",
9813 #endif
9814  .namespaceZero = true,
9815  .padding = offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - offsetof(UA_CreateSubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader),
9816  .isArray = false
9817  },
9818  { .memberTypeIndex = UA_TYPES_UINT32,
9819 #ifdef UA_ENABLE_TYPENAMES
9820  .memberName = "requestedLifetimeCount",
9821 #endif
9822  .namespaceZero = true,
9823  .padding = offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double),
9824  .isArray = false
9825  },
9826  { .memberTypeIndex = UA_TYPES_UINT32,
9827 #ifdef UA_ENABLE_TYPENAMES
9828  .memberName = "requestedMaxKeepAliveCount",
9829 #endif
9830  .namespaceZero = true,
9831  .padding = offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32),
9832  .isArray = false
9833  },
9834  { .memberTypeIndex = UA_TYPES_UINT32,
9835 #ifdef UA_ENABLE_TYPENAMES
9836  .memberName = "maxNotificationsPerPublish",
9837 #endif
9838  .namespaceZero = true,
9839  .padding = offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32),
9840  .isArray = false
9841  },
9842  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9843 #ifdef UA_ENABLE_TYPENAMES
9844  .memberName = "publishingEnabled",
9845 #endif
9846  .namespaceZero = true,
9847  .padding = offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32),
9848  .isArray = false
9849  },
9850  { .memberTypeIndex = UA_TYPES_BYTE,
9851 #ifdef UA_ENABLE_TYPENAMES
9852  .memberName = "priority",
9853 #endif
9854  .namespaceZero = true,
9855  .padding = offsetof(UA_CreateSubscriptionRequest, priority) - offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - sizeof(UA_Boolean),
9856  .isArray = false
9857  },};
9858 
9859 /* VariableTypeAttributes */
9860 static UA_DataTypeMember VariableTypeAttributes_members[10] = {
9862 #ifdef UA_ENABLE_TYPENAMES
9863  .memberName = "specifiedAttributes",
9864 #endif
9865  .namespaceZero = true,
9866  .padding = 0,
9867  .isArray = false
9868  },
9869  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9870 #ifdef UA_ENABLE_TYPENAMES
9871  .memberName = "displayName",
9872 #endif
9873  .namespaceZero = true,
9874  .padding = offsetof(UA_VariableTypeAttributes, displayName) - offsetof(UA_VariableTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9875  .isArray = false
9876  },
9877  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9878 #ifdef UA_ENABLE_TYPENAMES
9879  .memberName = "description",
9880 #endif
9881  .namespaceZero = true,
9882  .padding = offsetof(UA_VariableTypeAttributes, description) - offsetof(UA_VariableTypeAttributes, displayName) - sizeof(UA_LocalizedText),
9883  .isArray = false
9884  },
9885  { .memberTypeIndex = UA_TYPES_UINT32,
9886 #ifdef UA_ENABLE_TYPENAMES
9887  .memberName = "writeMask",
9888 #endif
9889  .namespaceZero = true,
9890  .padding = offsetof(UA_VariableTypeAttributes, writeMask) - offsetof(UA_VariableTypeAttributes, description) - sizeof(UA_LocalizedText),
9891  .isArray = false
9892  },
9893  { .memberTypeIndex = UA_TYPES_UINT32,
9894 #ifdef UA_ENABLE_TYPENAMES
9895  .memberName = "userWriteMask",
9896 #endif
9897  .namespaceZero = true,
9898  .padding = offsetof(UA_VariableTypeAttributes, userWriteMask) - offsetof(UA_VariableTypeAttributes, writeMask) - sizeof(UA_UInt32),
9899  .isArray = false
9900  },
9901  { .memberTypeIndex = UA_TYPES_VARIANT,
9902 #ifdef UA_ENABLE_TYPENAMES
9903  .memberName = "value",
9904 #endif
9905  .namespaceZero = true,
9906  .padding = offsetof(UA_VariableTypeAttributes, value) - offsetof(UA_VariableTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
9907  .isArray = false
9908  },
9909  { .memberTypeIndex = UA_TYPES_NODEID,
9910 #ifdef UA_ENABLE_TYPENAMES
9911  .memberName = "dataType",
9912 #endif
9913  .namespaceZero = true,
9914  .padding = offsetof(UA_VariableTypeAttributes, dataType) - offsetof(UA_VariableTypeAttributes, value) - sizeof(UA_Variant),
9915  .isArray = false
9916  },
9917  { .memberTypeIndex = UA_TYPES_INT32,
9918 #ifdef UA_ENABLE_TYPENAMES
9919  .memberName = "valueRank",
9920 #endif
9921  .namespaceZero = true,
9922  .padding = offsetof(UA_VariableTypeAttributes, valueRank) - offsetof(UA_VariableTypeAttributes, dataType) - sizeof(UA_NodeId),
9923  .isArray = false
9924  },
9925  { .memberTypeIndex = UA_TYPES_UINT32,
9926 #ifdef UA_ENABLE_TYPENAMES
9927  .memberName = "arrayDimensions",
9928 #endif
9929  .namespaceZero = true,
9930  .padding = offsetof(UA_VariableTypeAttributes, arrayDimensionsSize) - offsetof(UA_VariableTypeAttributes, valueRank) - sizeof(UA_Int32),
9931  .isArray = true
9932  },
9933  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9934 #ifdef UA_ENABLE_TYPENAMES
9935  .memberName = "isAbstract",
9936 #endif
9937  .namespaceZero = true,
9938  .padding = offsetof(UA_VariableTypeAttributes, isAbstract) - offsetof(UA_VariableTypeAttributes, arrayDimensions) - sizeof(void*),
9939  .isArray = false
9940  },};
9941 
9942 /* BrowsePathResult */
9943 static UA_DataTypeMember BrowsePathResult_members[2] = {
9945 #ifdef UA_ENABLE_TYPENAMES
9946  .memberName = "statusCode",
9947 #endif
9948  .namespaceZero = true,
9949  .padding = 0,
9950  .isArray = false
9951  },
9952  { .memberTypeIndex = UA_TYPES_BROWSEPATHTARGET,
9953 #ifdef UA_ENABLE_TYPENAMES
9954  .memberName = "targets",
9955 #endif
9956  .namespaceZero = true,
9957  .padding = offsetof(UA_BrowsePathResult, targetsSize) - offsetof(UA_BrowsePathResult, statusCode) - sizeof(UA_StatusCode),
9958  .isArray = true
9959  },};
9960 
9961 /* ModifySubscriptionResponse */
9962 static UA_DataTypeMember ModifySubscriptionResponse_members[4] = {
9964 #ifdef UA_ENABLE_TYPENAMES
9965  .memberName = "responseHeader",
9966 #endif
9967  .namespaceZero = true,
9968  .padding = 0,
9969  .isArray = false
9970  },
9971  { .memberTypeIndex = UA_TYPES_DOUBLE,
9972 #ifdef UA_ENABLE_TYPENAMES
9973  .memberName = "revisedPublishingInterval",
9974 #endif
9975  .namespaceZero = true,
9976  .padding = offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - offsetof(UA_ModifySubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader),
9977  .isArray = false
9978  },
9979  { .memberTypeIndex = UA_TYPES_UINT32,
9980 #ifdef UA_ENABLE_TYPENAMES
9981  .memberName = "revisedLifetimeCount",
9982 #endif
9983  .namespaceZero = true,
9984  .padding = offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double),
9985  .isArray = false
9986  },
9987  { .memberTypeIndex = UA_TYPES_UINT32,
9988 #ifdef UA_ENABLE_TYPENAMES
9989  .memberName = "revisedMaxKeepAliveCount",
9990 #endif
9991  .namespaceZero = true,
9992  .padding = offsetof(UA_ModifySubscriptionResponse, revisedMaxKeepAliveCount) - offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32),
9993  .isArray = false
9994  },};
9995 
9996 /* OpenSecureChannelRequest */
9997 static UA_DataTypeMember OpenSecureChannelRequest_members[6] = {
9999 #ifdef UA_ENABLE_TYPENAMES
10000  .memberName = "requestHeader",
10001 #endif
10002  .namespaceZero = true,
10003  .padding = 0,
10004  .isArray = false
10005  },
10006  { .memberTypeIndex = UA_TYPES_UINT32,
10007 #ifdef UA_ENABLE_TYPENAMES
10008  .memberName = "clientProtocolVersion",
10009 #endif
10010  .namespaceZero = true,
10011  .padding = offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - offsetof(UA_OpenSecureChannelRequest, requestHeader) - sizeof(UA_RequestHeader),
10012  .isArray = false
10013  },
10014  { .memberTypeIndex = UA_TYPES_SECURITYTOKENREQUESTTYPE,
10015 #ifdef UA_ENABLE_TYPENAMES
10016  .memberName = "requestType",
10017 #endif
10018  .namespaceZero = true,
10019  .padding = offsetof(UA_OpenSecureChannelRequest, requestType) - offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - sizeof(UA_UInt32),
10020  .isArray = false
10021  },
10022  { .memberTypeIndex = UA_TYPES_MESSAGESECURITYMODE,
10023 #ifdef UA_ENABLE_TYPENAMES
10024  .memberName = "securityMode",
10025 #endif
10026  .namespaceZero = true,
10027  .padding = offsetof(UA_OpenSecureChannelRequest, securityMode) - offsetof(UA_OpenSecureChannelRequest, requestType) - sizeof(UA_SecurityTokenRequestType),
10028  .isArray = false
10029  },
10030  { .memberTypeIndex = UA_TYPES_BYTESTRING,
10031 #ifdef UA_ENABLE_TYPENAMES
10032  .memberName = "clientNonce",
10033 #endif
10034  .namespaceZero = true,
10035  .padding = offsetof(UA_OpenSecureChannelRequest, clientNonce) - offsetof(UA_OpenSecureChannelRequest, securityMode) - sizeof(UA_MessageSecurityMode),
10036  .isArray = false
10037  },
10038  { .memberTypeIndex = UA_TYPES_UINT32,
10039 #ifdef UA_ENABLE_TYPENAMES
10040  .memberName = "requestedLifetime",
10041 #endif
10042  .namespaceZero = true,
10043  .padding = offsetof(UA_OpenSecureChannelRequest, requestedLifetime) - offsetof(UA_OpenSecureChannelRequest, clientNonce) - sizeof(UA_ByteString),
10044  .isArray = false
10045  },};
10046 
10047 /* RegisterNodesResponse */
10048 static UA_DataTypeMember RegisterNodesResponse_members[2] = {
10050 #ifdef UA_ENABLE_TYPENAMES
10051  .memberName = "responseHeader",
10052 #endif
10053  .namespaceZero = true,
10054  .padding = 0,
10055  .isArray = false
10056  },
10057  { .memberTypeIndex = UA_TYPES_NODEID,
10058 #ifdef UA_ENABLE_TYPENAMES
10059  .memberName = "registeredNodeIds",
10060 #endif
10061  .namespaceZero = true,
10062  .padding = offsetof(UA_RegisterNodesResponse, registeredNodeIdsSize) - offsetof(UA_RegisterNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10063  .isArray = true
10064  },};
10065 
10066 /* CloseSessionRequest */
10067 static UA_DataTypeMember CloseSessionRequest_members[2] = {
10069 #ifdef UA_ENABLE_TYPENAMES
10070  .memberName = "requestHeader",
10071 #endif
10072  .namespaceZero = true,
10073  .padding = 0,
10074  .isArray = false
10075  },
10076  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10077 #ifdef UA_ENABLE_TYPENAMES
10078  .memberName = "deleteSubscriptions",
10079 #endif
10080  .namespaceZero = true,
10081  .padding = offsetof(UA_CloseSessionRequest, deleteSubscriptions) - offsetof(UA_CloseSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
10082  .isArray = false
10083  },};
10084 
10085 /* ModifySubscriptionRequest */
10086 static UA_DataTypeMember ModifySubscriptionRequest_members[7] = {
10088 #ifdef UA_ENABLE_TYPENAMES
10089  .memberName = "requestHeader",
10090 #endif
10091  .namespaceZero = true,
10092  .padding = 0,
10093  .isArray = false
10094  },
10095  { .memberTypeIndex = UA_TYPES_UINT32,
10096 #ifdef UA_ENABLE_TYPENAMES
10097  .memberName = "subscriptionId",
10098 #endif
10099  .namespaceZero = true,
10100  .padding = offsetof(UA_ModifySubscriptionRequest, subscriptionId) - offsetof(UA_ModifySubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader),
10101  .isArray = false
10102  },
10103  { .memberTypeIndex = UA_TYPES_DOUBLE,
10104 #ifdef UA_ENABLE_TYPENAMES
10105  .memberName = "requestedPublishingInterval",
10106 #endif
10107  .namespaceZero = true,
10108  .padding = offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - offsetof(UA_ModifySubscriptionRequest, subscriptionId) - sizeof(UA_UInt32),
10109  .isArray = false
10110  },
10111  { .memberTypeIndex = UA_TYPES_UINT32,
10112 #ifdef UA_ENABLE_TYPENAMES
10113  .memberName = "requestedLifetimeCount",
10114 #endif
10115  .namespaceZero = true,
10116  .padding = offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double),
10117  .isArray = false
10118  },
10119  { .memberTypeIndex = UA_TYPES_UINT32,
10120 #ifdef UA_ENABLE_TYPENAMES
10121  .memberName = "requestedMaxKeepAliveCount",
10122 #endif
10123  .namespaceZero = true,
10124  .padding = offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32),
10125  .isArray = false
10126  },
10127  { .memberTypeIndex = UA_TYPES_UINT32,
10128 #ifdef UA_ENABLE_TYPENAMES
10129  .memberName = "maxNotificationsPerPublish",
10130 #endif
10131  .namespaceZero = true,
10132  .padding = offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32),
10133  .isArray = false
10134  },
10135  { .memberTypeIndex = UA_TYPES_BYTE,
10136 #ifdef UA_ENABLE_TYPENAMES
10137  .memberName = "priority",
10138 #endif
10139  .namespaceZero = true,
10140  .padding = offsetof(UA_ModifySubscriptionRequest, priority) - offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32),
10141  .isArray = false
10142  },};
10143 
10144 /* UserTokenPolicy */
10145 static UA_DataTypeMember UserTokenPolicy_members[5] = {
10147 #ifdef UA_ENABLE_TYPENAMES
10148  .memberName = "policyId",
10149 #endif
10150  .namespaceZero = true,
10151  .padding = 0,
10152  .isArray = false
10153  },
10154  { .memberTypeIndex = UA_TYPES_USERTOKENTYPE,
10155 #ifdef UA_ENABLE_TYPENAMES
10156  .memberName = "tokenType",
10157 #endif
10158  .namespaceZero = true,
10159  .padding = offsetof(UA_UserTokenPolicy, tokenType) - offsetof(UA_UserTokenPolicy, policyId) - sizeof(UA_String),
10160  .isArray = false
10161  },
10162  { .memberTypeIndex = UA_TYPES_STRING,
10163 #ifdef UA_ENABLE_TYPENAMES
10164  .memberName = "issuedTokenType",
10165 #endif
10166  .namespaceZero = true,
10167  .padding = offsetof(UA_UserTokenPolicy, issuedTokenType) - offsetof(UA_UserTokenPolicy, tokenType) - sizeof(UA_UserTokenType),
10168  .isArray = false
10169  },
10170  { .memberTypeIndex = UA_TYPES_STRING,
10171 #ifdef UA_ENABLE_TYPENAMES
10172  .memberName = "issuerEndpointUrl",
10173 #endif
10174  .namespaceZero = true,
10175  .padding = offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - offsetof(UA_UserTokenPolicy, issuedTokenType) - sizeof(UA_String),
10176  .isArray = false
10177  },
10178  { .memberTypeIndex = UA_TYPES_STRING,
10179 #ifdef UA_ENABLE_TYPENAMES
10180  .memberName = "securityPolicyUri",
10181 #endif
10182  .namespaceZero = true,
10183  .padding = offsetof(UA_UserTokenPolicy, securityPolicyUri) - offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - sizeof(UA_String),
10184  .isArray = false
10185  },};
10186 
10187 /* DeleteMonitoredItemsRequest */
10188 static UA_DataTypeMember DeleteMonitoredItemsRequest_members[3] = {
10190 #ifdef UA_ENABLE_TYPENAMES
10191  .memberName = "requestHeader",
10192 #endif
10193  .namespaceZero = true,
10194  .padding = 0,
10195  .isArray = false
10196  },
10197  { .memberTypeIndex = UA_TYPES_UINT32,
10198 #ifdef UA_ENABLE_TYPENAMES
10199  .memberName = "subscriptionId",
10200 #endif
10201  .namespaceZero = true,
10202  .padding = offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - offsetof(UA_DeleteMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
10203  .isArray = false
10204  },
10205  { .memberTypeIndex = UA_TYPES_UINT32,
10206 #ifdef UA_ENABLE_TYPENAMES
10207  .memberName = "monitoredItemIds",
10208 #endif
10209  .namespaceZero = true,
10210  .padding = offsetof(UA_DeleteMonitoredItemsRequest, monitoredItemIdsSize) - offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
10211  .isArray = true
10212  },};
10213 
10214 /* ReferenceTypeAttributes */
10215 static UA_DataTypeMember ReferenceTypeAttributes_members[8] = {
10217 #ifdef UA_ENABLE_TYPENAMES
10218  .memberName = "specifiedAttributes",
10219 #endif
10220  .namespaceZero = true,
10221  .padding = 0,
10222  .isArray = false
10223  },
10224  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10225 #ifdef UA_ENABLE_TYPENAMES
10226  .memberName = "displayName",
10227 #endif
10228  .namespaceZero = true,
10229  .padding = offsetof(UA_ReferenceTypeAttributes, displayName) - offsetof(UA_ReferenceTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
10230  .isArray = false
10231  },
10232  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10233 #ifdef UA_ENABLE_TYPENAMES
10234  .memberName = "description",
10235 #endif
10236  .namespaceZero = true,
10237  .padding = offsetof(UA_ReferenceTypeAttributes, description) - offsetof(UA_ReferenceTypeAttributes, displayName) - sizeof(UA_LocalizedText),
10238  .isArray = false
10239  },
10240  { .memberTypeIndex = UA_TYPES_UINT32,
10241 #ifdef UA_ENABLE_TYPENAMES
10242  .memberName = "writeMask",
10243 #endif
10244  .namespaceZero = true,
10245  .padding = offsetof(UA_ReferenceTypeAttributes, writeMask) - offsetof(UA_ReferenceTypeAttributes, description) - sizeof(UA_LocalizedText),
10246  .isArray = false
10247  },
10248  { .memberTypeIndex = UA_TYPES_UINT32,
10249 #ifdef UA_ENABLE_TYPENAMES
10250  .memberName = "userWriteMask",
10251 #endif
10252  .namespaceZero = true,
10253  .padding = offsetof(UA_ReferenceTypeAttributes, userWriteMask) - offsetof(UA_ReferenceTypeAttributes, writeMask) - sizeof(UA_UInt32),
10254  .isArray = false
10255  },
10256  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10257 #ifdef UA_ENABLE_TYPENAMES
10258  .memberName = "isAbstract",
10259 #endif
10260  .namespaceZero = true,
10261  .padding = offsetof(UA_ReferenceTypeAttributes, isAbstract) - offsetof(UA_ReferenceTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
10262  .isArray = false
10263  },
10264  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10265 #ifdef UA_ENABLE_TYPENAMES
10266  .memberName = "symmetric",
10267 #endif
10268  .namespaceZero = true,
10269  .padding = offsetof(UA_ReferenceTypeAttributes, symmetric) - offsetof(UA_ReferenceTypeAttributes, isAbstract) - sizeof(UA_Boolean),
10270  .isArray = false
10271  },
10272  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10273 #ifdef UA_ENABLE_TYPENAMES
10274  .memberName = "inverseName",
10275 #endif
10276  .namespaceZero = true,
10277  .padding = offsetof(UA_ReferenceTypeAttributes, inverseName) - offsetof(UA_ReferenceTypeAttributes, symmetric) - sizeof(UA_Boolean),
10278  .isArray = false
10279  },};
10280 
10281 /* SetMonitoringModeRequest */
10282 static UA_DataTypeMember SetMonitoringModeRequest_members[4] = {
10284 #ifdef UA_ENABLE_TYPENAMES
10285  .memberName = "requestHeader",
10286 #endif
10287  .namespaceZero = true,
10288  .padding = 0,
10289  .isArray = false
10290  },
10291  { .memberTypeIndex = UA_TYPES_UINT32,
10292 #ifdef UA_ENABLE_TYPENAMES
10293  .memberName = "subscriptionId",
10294 #endif
10295  .namespaceZero = true,
10296  .padding = offsetof(UA_SetMonitoringModeRequest, subscriptionId) - offsetof(UA_SetMonitoringModeRequest, requestHeader) - sizeof(UA_RequestHeader),
10297  .isArray = false
10298  },
10299  { .memberTypeIndex = UA_TYPES_MONITORINGMODE,
10300 #ifdef UA_ENABLE_TYPENAMES
10301  .memberName = "monitoringMode",
10302 #endif
10303  .namespaceZero = true,
10304  .padding = offsetof(UA_SetMonitoringModeRequest, monitoringMode) - offsetof(UA_SetMonitoringModeRequest, subscriptionId) - sizeof(UA_UInt32),
10305  .isArray = false
10306  },
10307  { .memberTypeIndex = UA_TYPES_UINT32,
10308 #ifdef UA_ENABLE_TYPENAMES
10309  .memberName = "monitoredItemIds",
10310 #endif
10311  .namespaceZero = true,
10312  .padding = offsetof(UA_SetMonitoringModeRequest, monitoredItemIdsSize) - offsetof(UA_SetMonitoringModeRequest, monitoringMode) - sizeof(UA_MonitoringMode),
10313  .isArray = true
10314  },};
10315 
10316 /* UnregisterNodesResponse */
10317 static UA_DataTypeMember UnregisterNodesResponse_members[1] = {
10319 #ifdef UA_ENABLE_TYPENAMES
10320  .memberName = "responseHeader",
10321 #endif
10322  .namespaceZero = true,
10323  .padding = 0,
10324  .isArray = false
10325  },};
10326 
10327 /* WriteRequest */
10328 static UA_DataTypeMember WriteRequest_members[2] = {
10330 #ifdef UA_ENABLE_TYPENAMES
10331  .memberName = "requestHeader",
10332 #endif
10333  .namespaceZero = true,
10334  .padding = 0,
10335  .isArray = false
10336  },
10337  { .memberTypeIndex = UA_TYPES_WRITEVALUE,
10338 #ifdef UA_ENABLE_TYPENAMES
10339  .memberName = "nodesToWrite",
10340 #endif
10341  .namespaceZero = true,
10342  .padding = offsetof(UA_WriteRequest, nodesToWriteSize) - offsetof(UA_WriteRequest, requestHeader) - sizeof(UA_RequestHeader),
10343  .isArray = true
10344  },};
10345 
10346 /* ObjectAttributes */
10347 static UA_DataTypeMember ObjectAttributes_members[6] = {
10349 #ifdef UA_ENABLE_TYPENAMES
10350  .memberName = "specifiedAttributes",
10351 #endif
10352  .namespaceZero = true,
10353  .padding = 0,
10354  .isArray = false
10355  },
10356  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10357 #ifdef UA_ENABLE_TYPENAMES
10358  .memberName = "displayName",
10359 #endif
10360  .namespaceZero = true,
10361  .padding = offsetof(UA_ObjectAttributes, displayName) - offsetof(UA_ObjectAttributes, specifiedAttributes) - sizeof(UA_UInt32),
10362  .isArray = false
10363  },
10364  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10365 #ifdef UA_ENABLE_TYPENAMES
10366  .memberName = "description",
10367 #endif
10368  .namespaceZero = true,
10369  .padding = offsetof(UA_ObjectAttributes, description) - offsetof(UA_ObjectAttributes, displayName) - sizeof(UA_LocalizedText),
10370  .isArray = false
10371  },
10372  { .memberTypeIndex = UA_TYPES_UINT32,
10373 #ifdef UA_ENABLE_TYPENAMES
10374  .memberName = "writeMask",
10375 #endif
10376  .namespaceZero = true,
10377  .padding = offsetof(UA_ObjectAttributes, writeMask) - offsetof(UA_ObjectAttributes, description) - sizeof(UA_LocalizedText),
10378  .isArray = false
10379  },
10380  { .memberTypeIndex = UA_TYPES_UINT32,
10381 #ifdef UA_ENABLE_TYPENAMES
10382  .memberName = "userWriteMask",
10383 #endif
10384  .namespaceZero = true,
10385  .padding = offsetof(UA_ObjectAttributes, userWriteMask) - offsetof(UA_ObjectAttributes, writeMask) - sizeof(UA_UInt32),
10386  .isArray = false
10387  },
10388  { .memberTypeIndex = UA_TYPES_BYTE,
10389 #ifdef UA_ENABLE_TYPENAMES
10390  .memberName = "eventNotifier",
10391 #endif
10392  .namespaceZero = true,
10393  .padding = offsetof(UA_ObjectAttributes, eventNotifier) - offsetof(UA_ObjectAttributes, userWriteMask) - sizeof(UA_UInt32),
10394  .isArray = false
10395  },};
10396 
10397 /* BrowseDescription */
10398 static UA_DataTypeMember BrowseDescription_members[6] = {
10400 #ifdef UA_ENABLE_TYPENAMES
10401  .memberName = "nodeId",
10402 #endif
10403  .namespaceZero = true,
10404  .padding = 0,
10405  .isArray = false
10406  },
10407  { .memberTypeIndex = UA_TYPES_BROWSEDIRECTION,
10408 #ifdef UA_ENABLE_TYPENAMES
10409  .memberName = "browseDirection",
10410 #endif
10411  .namespaceZero = true,
10412  .padding = offsetof(UA_BrowseDescription, browseDirection) - offsetof(UA_BrowseDescription, nodeId) - sizeof(UA_NodeId),
10413  .isArray = false
10414  },
10415  { .memberTypeIndex = UA_TYPES_NODEID,
10416 #ifdef UA_ENABLE_TYPENAMES
10417  .memberName = "referenceTypeId",
10418 #endif
10419  .namespaceZero = true,
10420  .padding = offsetof(UA_BrowseDescription, referenceTypeId) - offsetof(UA_BrowseDescription, browseDirection) - sizeof(UA_BrowseDirection),
10421  .isArray = false
10422  },
10423  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10424 #ifdef UA_ENABLE_TYPENAMES
10425  .memberName = "includeSubtypes",
10426 #endif
10427  .namespaceZero = true,
10428  .padding = offsetof(UA_BrowseDescription, includeSubtypes) - offsetof(UA_BrowseDescription, referenceTypeId) - sizeof(UA_NodeId),
10429  .isArray = false
10430  },
10431  { .memberTypeIndex = UA_TYPES_UINT32,
10432 #ifdef UA_ENABLE_TYPENAMES
10433  .memberName = "nodeClassMask",
10434 #endif
10435  .namespaceZero = true,
10436  .padding = offsetof(UA_BrowseDescription, nodeClassMask) - offsetof(UA_BrowseDescription, includeSubtypes) - sizeof(UA_Boolean),
10437  .isArray = false
10438  },
10439  { .memberTypeIndex = UA_TYPES_UINT32,
10440 #ifdef UA_ENABLE_TYPENAMES
10441  .memberName = "resultMask",
10442 #endif
10443  .namespaceZero = true,
10444  .padding = offsetof(UA_BrowseDescription, resultMask) - offsetof(UA_BrowseDescription, nodeClassMask) - sizeof(UA_UInt32),
10445  .isArray = false
10446  },};
10447 
10448 /* RepublishRequest */
10449 static UA_DataTypeMember RepublishRequest_members[3] = {
10451 #ifdef UA_ENABLE_TYPENAMES
10452  .memberName = "requestHeader",
10453 #endif
10454  .namespaceZero = true,
10455  .padding = 0,
10456  .isArray = false
10457  },
10458  { .memberTypeIndex = UA_TYPES_UINT32,
10459 #ifdef UA_ENABLE_TYPENAMES
10460  .memberName = "subscriptionId",
10461 #endif
10462  .namespaceZero = true,
10463  .padding = offsetof(UA_RepublishRequest, subscriptionId) - offsetof(UA_RepublishRequest, requestHeader) - sizeof(UA_RequestHeader),
10464  .isArray = false
10465  },
10466  { .memberTypeIndex = UA_TYPES_UINT32,
10467 #ifdef UA_ENABLE_TYPENAMES
10468  .memberName = "retransmitSequenceNumber",
10469 #endif
10470  .namespaceZero = true,
10471  .padding = offsetof(UA_RepublishRequest, retransmitSequenceNumber) - offsetof(UA_RepublishRequest, subscriptionId) - sizeof(UA_UInt32),
10472  .isArray = false
10473  },};
10474 
10475 /* GetEndpointsRequest */
10476 static UA_DataTypeMember GetEndpointsRequest_members[4] = {
10478 #ifdef UA_ENABLE_TYPENAMES
10479  .memberName = "requestHeader",
10480 #endif
10481  .namespaceZero = true,
10482  .padding = 0,
10483  .isArray = false
10484  },
10485  { .memberTypeIndex = UA_TYPES_STRING,
10486 #ifdef UA_ENABLE_TYPENAMES
10487  .memberName = "endpointUrl",
10488 #endif
10489  .namespaceZero = true,
10490  .padding = offsetof(UA_GetEndpointsRequest, endpointUrl) - offsetof(UA_GetEndpointsRequest, requestHeader) - sizeof(UA_RequestHeader),
10491  .isArray = false
10492  },
10493  { .memberTypeIndex = UA_TYPES_STRING,
10494 #ifdef UA_ENABLE_TYPENAMES
10495  .memberName = "localeIds",
10496 #endif
10497  .namespaceZero = true,
10498  .padding = offsetof(UA_GetEndpointsRequest, localeIdsSize) - offsetof(UA_GetEndpointsRequest, endpointUrl) - sizeof(UA_String),
10499  .isArray = true
10500  },
10501  { .memberTypeIndex = UA_TYPES_STRING,
10502 #ifdef UA_ENABLE_TYPENAMES
10503  .memberName = "profileUris",
10504 #endif
10505  .namespaceZero = true,
10506  .padding = offsetof(UA_GetEndpointsRequest, profileUrisSize) - offsetof(UA_GetEndpointsRequest, localeIds) - sizeof(void*),
10507  .isArray = true
10508  },};
10509 
10510 /* PublishRequest */
10511 static UA_DataTypeMember PublishRequest_members[2] = {
10513 #ifdef UA_ENABLE_TYPENAMES
10514  .memberName = "requestHeader",
10515 #endif
10516  .namespaceZero = true,
10517  .padding = 0,
10518  .isArray = false
10519  },
10520  { .memberTypeIndex = UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT,
10521 #ifdef UA_ENABLE_TYPENAMES
10522  .memberName = "subscriptionAcknowledgements",
10523 #endif
10524  .namespaceZero = true,
10525  .padding = offsetof(UA_PublishRequest, subscriptionAcknowledgementsSize) - offsetof(UA_PublishRequest, requestHeader) - sizeof(UA_RequestHeader),
10526  .isArray = true
10527  },};
10528 
10529 /* AddNodesResponse */
10530 static UA_DataTypeMember AddNodesResponse_members[3] = {
10532 #ifdef UA_ENABLE_TYPENAMES
10533  .memberName = "responseHeader",
10534 #endif
10535  .namespaceZero = true,
10536  .padding = 0,
10537  .isArray = false
10538  },
10539  { .memberTypeIndex = UA_TYPES_ADDNODESRESULT,
10540 #ifdef UA_ENABLE_TYPENAMES
10541  .memberName = "results",
10542 #endif
10543  .namespaceZero = true,
10544  .padding = offsetof(UA_AddNodesResponse, resultsSize) - offsetof(UA_AddNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10545  .isArray = true
10546  },
10547  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10548 #ifdef UA_ENABLE_TYPENAMES
10549  .memberName = "diagnosticInfos",
10550 #endif
10551  .namespaceZero = true,
10552  .padding = offsetof(UA_AddNodesResponse, diagnosticInfosSize) - offsetof(UA_AddNodesResponse, results) - sizeof(void*),
10553  .isArray = true
10554  },};
10555 
10556 /* DataChangeNotification */
10557 static UA_DataTypeMember DataChangeNotification_members[2] = {
10559 #ifdef UA_ENABLE_TYPENAMES
10560  .memberName = "monitoredItems",
10561 #endif
10562  .namespaceZero = true,
10563  .padding = 0,
10564  .isArray = true
10565  },
10566  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10567 #ifdef UA_ENABLE_TYPENAMES
10568  .memberName = "diagnosticInfos",
10569 #endif
10570  .namespaceZero = true,
10571  .padding = offsetof(UA_DataChangeNotification, diagnosticInfosSize) - offsetof(UA_DataChangeNotification, monitoredItems) - sizeof(void*),
10572  .isArray = true
10573  },};
10574 
10575 /* CloseSecureChannelResponse */
10576 static UA_DataTypeMember CloseSecureChannelResponse_members[1] = {
10578 #ifdef UA_ENABLE_TYPENAMES
10579  .memberName = "responseHeader",
10580 #endif
10581  .namespaceZero = true,
10582  .padding = 0,
10583  .isArray = false
10584  },};
10585 
10586 /* ModifyMonitoredItemsRequest */
10587 static UA_DataTypeMember ModifyMonitoredItemsRequest_members[4] = {
10589 #ifdef UA_ENABLE_TYPENAMES
10590  .memberName = "requestHeader",
10591 #endif
10592  .namespaceZero = true,
10593  .padding = 0,
10594  .isArray = false
10595  },
10596  { .memberTypeIndex = UA_TYPES_UINT32,
10597 #ifdef UA_ENABLE_TYPENAMES
10598  .memberName = "subscriptionId",
10599 #endif
10600  .namespaceZero = true,
10601  .padding = offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - offsetof(UA_ModifyMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
10602  .isArray = false
10603  },
10604  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
10605 #ifdef UA_ENABLE_TYPENAMES
10606  .memberName = "timestampsToReturn",
10607 #endif
10608  .namespaceZero = true,
10609  .padding = offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
10610  .isArray = false
10611  },
10612  { .memberTypeIndex = UA_TYPES_MONITOREDITEMMODIFYREQUEST,
10613 #ifdef UA_ENABLE_TYPENAMES
10614  .memberName = "itemsToModify",
10615 #endif
10616  .namespaceZero = true,
10617  .padding = offsetof(UA_ModifyMonitoredItemsRequest, itemsToModifySize) - offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
10618  .isArray = true
10619  },};
10620 
10621 /* SetMonitoringModeResponse */
10622 static UA_DataTypeMember SetMonitoringModeResponse_members[3] = {
10624 #ifdef UA_ENABLE_TYPENAMES
10625  .memberName = "responseHeader",
10626 #endif
10627  .namespaceZero = true,
10628  .padding = 0,
10629  .isArray = false
10630  },
10631  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10632 #ifdef UA_ENABLE_TYPENAMES
10633  .memberName = "results",
10634 #endif
10635  .namespaceZero = true,
10636  .padding = offsetof(UA_SetMonitoringModeResponse, resultsSize) - offsetof(UA_SetMonitoringModeResponse, responseHeader) - sizeof(UA_ResponseHeader),
10637  .isArray = true
10638  },
10639  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10640 #ifdef UA_ENABLE_TYPENAMES
10641  .memberName = "diagnosticInfos",
10642 #endif
10643  .namespaceZero = true,
10644  .padding = offsetof(UA_SetMonitoringModeResponse, diagnosticInfosSize) - offsetof(UA_SetMonitoringModeResponse, results) - sizeof(void*),
10645  .isArray = true
10646  },};
10647 
10648 /* FindServersRequest */
10649 static UA_DataTypeMember FindServersRequest_members[4] = {
10651 #ifdef UA_ENABLE_TYPENAMES
10652  .memberName = "requestHeader",
10653 #endif
10654  .namespaceZero = true,
10655  .padding = 0,
10656  .isArray = false
10657  },
10658  { .memberTypeIndex = UA_TYPES_STRING,
10659 #ifdef UA_ENABLE_TYPENAMES
10660  .memberName = "endpointUrl",
10661 #endif
10662  .namespaceZero = true,
10663  .padding = offsetof(UA_FindServersRequest, endpointUrl) - offsetof(UA_FindServersRequest, requestHeader) - sizeof(UA_RequestHeader),
10664  .isArray = false
10665  },
10666  { .memberTypeIndex = UA_TYPES_STRING,
10667 #ifdef UA_ENABLE_TYPENAMES
10668  .memberName = "localeIds",
10669 #endif
10670  .namespaceZero = true,
10671  .padding = offsetof(UA_FindServersRequest, localeIdsSize) - offsetof(UA_FindServersRequest, endpointUrl) - sizeof(UA_String),
10672  .isArray = true
10673  },
10674  { .memberTypeIndex = UA_TYPES_STRING,
10675 #ifdef UA_ENABLE_TYPENAMES
10676  .memberName = "serverUris",
10677 #endif
10678  .namespaceZero = true,
10679  .padding = offsetof(UA_FindServersRequest, serverUrisSize) - offsetof(UA_FindServersRequest, localeIds) - sizeof(void*),
10680  .isArray = true
10681  },};
10682 
10683 /* ReferenceDescription */
10684 static UA_DataTypeMember ReferenceDescription_members[7] = {
10686 #ifdef UA_ENABLE_TYPENAMES
10687  .memberName = "referenceTypeId",
10688 #endif
10689  .namespaceZero = true,
10690  .padding = 0,
10691  .isArray = false
10692  },
10693  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10694 #ifdef UA_ENABLE_TYPENAMES
10695  .memberName = "isForward",
10696 #endif
10697  .namespaceZero = true,
10698  .padding = offsetof(UA_ReferenceDescription, isForward) - offsetof(UA_ReferenceDescription, referenceTypeId) - sizeof(UA_NodeId),
10699  .isArray = false
10700  },
10701  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10702 #ifdef UA_ENABLE_TYPENAMES
10703  .memberName = "nodeId",
10704 #endif
10705  .namespaceZero = true,
10706  .padding = offsetof(UA_ReferenceDescription, nodeId) - offsetof(UA_ReferenceDescription, isForward) - sizeof(UA_Boolean),
10707  .isArray = false
10708  },
10709  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
10710 #ifdef UA_ENABLE_TYPENAMES
10711  .memberName = "browseName",
10712 #endif
10713  .namespaceZero = true,
10714  .padding = offsetof(UA_ReferenceDescription, browseName) - offsetof(UA_ReferenceDescription, nodeId) - sizeof(UA_ExpandedNodeId),
10715  .isArray = false
10716  },
10717  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10718 #ifdef UA_ENABLE_TYPENAMES
10719  .memberName = "displayName",
10720 #endif
10721  .namespaceZero = true,
10722  .padding = offsetof(UA_ReferenceDescription, displayName) - offsetof(UA_ReferenceDescription, browseName) - sizeof(UA_QualifiedName),
10723  .isArray = false
10724  },
10725  { .memberTypeIndex = UA_TYPES_NODECLASS,
10726 #ifdef UA_ENABLE_TYPENAMES
10727  .memberName = "nodeClass",
10728 #endif
10729  .namespaceZero = true,
10730  .padding = offsetof(UA_ReferenceDescription, nodeClass) - offsetof(UA_ReferenceDescription, displayName) - sizeof(UA_LocalizedText),
10731  .isArray = false
10732  },
10733  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10734 #ifdef UA_ENABLE_TYPENAMES
10735  .memberName = "typeDefinition",
10736 #endif
10737  .namespaceZero = true,
10738  .padding = offsetof(UA_ReferenceDescription, typeDefinition) - offsetof(UA_ReferenceDescription, nodeClass) - sizeof(UA_NodeClass),
10739  .isArray = false
10740  },};
10741 
10742 /* SetPublishingModeResponse */
10743 static UA_DataTypeMember SetPublishingModeResponse_members[3] = {
10745 #ifdef UA_ENABLE_TYPENAMES
10746  .memberName = "responseHeader",
10747 #endif
10748  .namespaceZero = true,
10749  .padding = 0,
10750  .isArray = false
10751  },
10752  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10753 #ifdef UA_ENABLE_TYPENAMES
10754  .memberName = "results",
10755 #endif
10756  .namespaceZero = true,
10757  .padding = offsetof(UA_SetPublishingModeResponse, resultsSize) - offsetof(UA_SetPublishingModeResponse, responseHeader) - sizeof(UA_ResponseHeader),
10758  .isArray = true
10759  },
10760  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10761 #ifdef UA_ENABLE_TYPENAMES
10762  .memberName = "diagnosticInfos",
10763 #endif
10764  .namespaceZero = true,
10765  .padding = offsetof(UA_SetPublishingModeResponse, diagnosticInfosSize) - offsetof(UA_SetPublishingModeResponse, results) - sizeof(void*),
10766  .isArray = true
10767  },};
10768 
10769 /* ContentFilterResult */
10770 static UA_DataTypeMember ContentFilterResult_members[2] = {
10772 #ifdef UA_ENABLE_TYPENAMES
10773  .memberName = "elementResults",
10774 #endif
10775  .namespaceZero = true,
10776  .padding = 0,
10777  .isArray = true
10778  },
10779  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10780 #ifdef UA_ENABLE_TYPENAMES
10781  .memberName = "elementDiagnosticInfos",
10782 #endif
10783  .namespaceZero = true,
10784  .padding = offsetof(UA_ContentFilterResult, elementDiagnosticInfosSize) - offsetof(UA_ContentFilterResult, elementResults) - sizeof(void*),
10785  .isArray = true
10786  },};
10787 
10788 /* AddReferencesItem */
10789 static UA_DataTypeMember AddReferencesItem_members[6] = {
10791 #ifdef UA_ENABLE_TYPENAMES
10792  .memberName = "sourceNodeId",
10793 #endif
10794  .namespaceZero = true,
10795  .padding = 0,
10796  .isArray = false
10797  },
10798  { .memberTypeIndex = UA_TYPES_NODEID,
10799 #ifdef UA_ENABLE_TYPENAMES
10800  .memberName = "referenceTypeId",
10801 #endif
10802  .namespaceZero = true,
10803  .padding = offsetof(UA_AddReferencesItem, referenceTypeId) - offsetof(UA_AddReferencesItem, sourceNodeId) - sizeof(UA_NodeId),
10804  .isArray = false
10805  },
10806  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10807 #ifdef UA_ENABLE_TYPENAMES
10808  .memberName = "isForward",
10809 #endif
10810  .namespaceZero = true,
10811  .padding = offsetof(UA_AddReferencesItem, isForward) - offsetof(UA_AddReferencesItem, referenceTypeId) - sizeof(UA_NodeId),
10812  .isArray = false
10813  },
10814  { .memberTypeIndex = UA_TYPES_STRING,
10815 #ifdef UA_ENABLE_TYPENAMES
10816  .memberName = "targetServerUri",
10817 #endif
10818  .namespaceZero = true,
10819  .padding = offsetof(UA_AddReferencesItem, targetServerUri) - offsetof(UA_AddReferencesItem, isForward) - sizeof(UA_Boolean),
10820  .isArray = false
10821  },
10822  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10823 #ifdef UA_ENABLE_TYPENAMES
10824  .memberName = "targetNodeId",
10825 #endif
10826  .namespaceZero = true,
10827  .padding = offsetof(UA_AddReferencesItem, targetNodeId) - offsetof(UA_AddReferencesItem, targetServerUri) - sizeof(UA_String),
10828  .isArray = false
10829  },
10830  { .memberTypeIndex = UA_TYPES_NODECLASS,
10831 #ifdef UA_ENABLE_TYPENAMES
10832  .memberName = "targetNodeClass",
10833 #endif
10834  .namespaceZero = true,
10835  .padding = offsetof(UA_AddReferencesItem, targetNodeClass) - offsetof(UA_AddReferencesItem, targetNodeId) - sizeof(UA_ExpandedNodeId),
10836  .isArray = false
10837  },};
10838 
10839 /* CreateSubscriptionResponse */
10840 static UA_DataTypeMember CreateSubscriptionResponse_members[5] = {
10842 #ifdef UA_ENABLE_TYPENAMES
10843  .memberName = "responseHeader",
10844 #endif
10845  .namespaceZero = true,
10846  .padding = 0,
10847  .isArray = false
10848  },
10849  { .memberTypeIndex = UA_TYPES_UINT32,
10850 #ifdef UA_ENABLE_TYPENAMES
10851  .memberName = "subscriptionId",
10852 #endif
10853  .namespaceZero = true,
10854  .padding = offsetof(UA_CreateSubscriptionResponse, subscriptionId) - offsetof(UA_CreateSubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader),
10855  .isArray = false
10856  },
10857  { .memberTypeIndex = UA_TYPES_DOUBLE,
10858 #ifdef UA_ENABLE_TYPENAMES
10859  .memberName = "revisedPublishingInterval",
10860 #endif
10861  .namespaceZero = true,
10862  .padding = offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - offsetof(UA_CreateSubscriptionResponse, subscriptionId) - sizeof(UA_UInt32),
10863  .isArray = false
10864  },
10865  { .memberTypeIndex = UA_TYPES_UINT32,
10866 #ifdef UA_ENABLE_TYPENAMES
10867  .memberName = "revisedLifetimeCount",
10868 #endif
10869  .namespaceZero = true,
10870  .padding = offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double),
10871  .isArray = false
10872  },
10873  { .memberTypeIndex = UA_TYPES_UINT32,
10874 #ifdef UA_ENABLE_TYPENAMES
10875  .memberName = "revisedMaxKeepAliveCount",
10876 #endif
10877  .namespaceZero = true,
10878  .padding = offsetof(UA_CreateSubscriptionResponse, revisedMaxKeepAliveCount) - offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32),
10879  .isArray = false
10880  },};
10881 
10882 /* DeleteSubscriptionsResponse */
10883 static UA_DataTypeMember DeleteSubscriptionsResponse_members[3] = {
10885 #ifdef UA_ENABLE_TYPENAMES
10886  .memberName = "responseHeader",
10887 #endif
10888  .namespaceZero = true,
10889  .padding = 0,
10890  .isArray = false
10891  },
10892  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10893 #ifdef UA_ENABLE_TYPENAMES
10894  .memberName = "results",
10895 #endif
10896  .namespaceZero = true,
10897  .padding = offsetof(UA_DeleteSubscriptionsResponse, resultsSize) - offsetof(UA_DeleteSubscriptionsResponse, responseHeader) - sizeof(UA_ResponseHeader),
10898  .isArray = true
10899  },
10900  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10901 #ifdef UA_ENABLE_TYPENAMES
10902  .memberName = "diagnosticInfos",
10903 #endif
10904  .namespaceZero = true,
10905  .padding = offsetof(UA_DeleteSubscriptionsResponse, diagnosticInfosSize) - offsetof(UA_DeleteSubscriptionsResponse, results) - sizeof(void*),
10906  .isArray = true
10907  },};
10908 
10909 /* RelativePath */
10910 static UA_DataTypeMember RelativePath_members[1] = {
10912 #ifdef UA_ENABLE_TYPENAMES
10913  .memberName = "elements",
10914 #endif
10915  .namespaceZero = true,
10916  .padding = 0,
10917  .isArray = true
10918  },};
10919 
10920 /* DeleteReferencesResponse */
10921 static UA_DataTypeMember DeleteReferencesResponse_members[3] = {
10923 #ifdef UA_ENABLE_TYPENAMES
10924  .memberName = "responseHeader",
10925 #endif
10926  .namespaceZero = true,
10927  .padding = 0,
10928  .isArray = false
10929  },
10930  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10931 #ifdef UA_ENABLE_TYPENAMES
10932  .memberName = "results",
10933 #endif
10934  .namespaceZero = true,
10935  .padding = offsetof(UA_DeleteReferencesResponse, resultsSize) - offsetof(UA_DeleteReferencesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10936  .isArray = true
10937  },
10938  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10939 #ifdef UA_ENABLE_TYPENAMES
10940  .memberName = "diagnosticInfos",
10941 #endif
10942  .namespaceZero = true,
10943  .padding = offsetof(UA_DeleteReferencesResponse, diagnosticInfosSize) - offsetof(UA_DeleteReferencesResponse, results) - sizeof(void*),
10944  .isArray = true
10945  },};
10946 
10947 /* CreateMonitoredItemsResponse */
10948 static UA_DataTypeMember CreateMonitoredItemsResponse_members[3] = {
10950 #ifdef UA_ENABLE_TYPENAMES
10951  .memberName = "responseHeader",
10952 #endif
10953  .namespaceZero = true,
10954  .padding = 0,
10955  .isArray = false
10956  },
10957  { .memberTypeIndex = UA_TYPES_MONITOREDITEMCREATERESULT,
10958 #ifdef UA_ENABLE_TYPENAMES
10959  .memberName = "results",
10960 #endif
10961  .namespaceZero = true,
10962  .padding = offsetof(UA_CreateMonitoredItemsResponse, resultsSize) - offsetof(UA_CreateMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
10963  .isArray = true
10964  },
10965  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10966 #ifdef UA_ENABLE_TYPENAMES
10967  .memberName = "diagnosticInfos",
10968 #endif
10969  .namespaceZero = true,
10970  .padding = offsetof(UA_CreateMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_CreateMonitoredItemsResponse, results) - sizeof(void*),
10971  .isArray = true
10972  },};
10973 
10974 /* CallResponse */
10975 static UA_DataTypeMember CallResponse_members[3] = {
10977 #ifdef UA_ENABLE_TYPENAMES
10978  .memberName = "responseHeader",
10979 #endif
10980  .namespaceZero = true,
10981  .padding = 0,
10982  .isArray = false
10983  },
10984  { .memberTypeIndex = UA_TYPES_CALLMETHODRESULT,
10985 #ifdef UA_ENABLE_TYPENAMES
10986  .memberName = "results",
10987 #endif
10988  .namespaceZero = true,
10989  .padding = offsetof(UA_CallResponse, resultsSize) - offsetof(UA_CallResponse, responseHeader) - sizeof(UA_ResponseHeader),
10990  .isArray = true
10991  },
10992  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10993 #ifdef UA_ENABLE_TYPENAMES
10994  .memberName = "diagnosticInfos",
10995 #endif
10996  .namespaceZero = true,
10997  .padding = offsetof(UA_CallResponse, diagnosticInfosSize) - offsetof(UA_CallResponse, results) - sizeof(void*),
10998  .isArray = true
10999  },};
11000 
11001 /* DeleteNodesResponse */
11002 static UA_DataTypeMember DeleteNodesResponse_members[3] = {
11004 #ifdef UA_ENABLE_TYPENAMES
11005  .memberName = "responseHeader",
11006 #endif
11007  .namespaceZero = true,
11008  .padding = 0,
11009  .isArray = false
11010  },
11011  { .memberTypeIndex = UA_TYPES_STATUSCODE,
11012 #ifdef UA_ENABLE_TYPENAMES
11013  .memberName = "results",
11014 #endif
11015  .namespaceZero = true,
11016  .padding = offsetof(UA_DeleteNodesResponse, resultsSize) - offsetof(UA_DeleteNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
11017  .isArray = true
11018  },
11019  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11020 #ifdef UA_ENABLE_TYPENAMES
11021  .memberName = "diagnosticInfos",
11022 #endif
11023  .namespaceZero = true,
11024  .padding = offsetof(UA_DeleteNodesResponse, diagnosticInfosSize) - offsetof(UA_DeleteNodesResponse, results) - sizeof(void*),
11025  .isArray = true
11026  },};
11027 
11028 /* RepublishResponse */
11029 static UA_DataTypeMember RepublishResponse_members[2] = {
11031 #ifdef UA_ENABLE_TYPENAMES
11032  .memberName = "responseHeader",
11033 #endif
11034  .namespaceZero = true,
11035  .padding = 0,
11036  .isArray = false
11037  },
11038  { .memberTypeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
11039 #ifdef UA_ENABLE_TYPENAMES
11040  .memberName = "notificationMessage",
11041 #endif
11042  .namespaceZero = true,
11043  .padding = offsetof(UA_RepublishResponse, notificationMessage) - offsetof(UA_RepublishResponse, responseHeader) - sizeof(UA_ResponseHeader),
11044  .isArray = false
11045  },};
11046 
11047 /* MonitoredItemCreateRequest */
11048 static UA_DataTypeMember MonitoredItemCreateRequest_members[3] = {
11050 #ifdef UA_ENABLE_TYPENAMES
11051  .memberName = "itemToMonitor",
11052 #endif
11053  .namespaceZero = true,
11054  .padding = 0,
11055  .isArray = false
11056  },
11057  { .memberTypeIndex = UA_TYPES_MONITORINGMODE,
11058 #ifdef UA_ENABLE_TYPENAMES
11059  .memberName = "monitoringMode",
11060 #endif
11061  .namespaceZero = true,
11062  .padding = offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - offsetof(UA_MonitoredItemCreateRequest, itemToMonitor) - sizeof(UA_ReadValueId),
11063  .isArray = false
11064  },
11065  { .memberTypeIndex = UA_TYPES_MONITORINGPARAMETERS,
11066 #ifdef UA_ENABLE_TYPENAMES
11067  .memberName = "requestedParameters",
11068 #endif
11069  .namespaceZero = true,
11070  .padding = offsetof(UA_MonitoredItemCreateRequest, requestedParameters) - offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - sizeof(UA_MonitoringMode),
11071  .isArray = false
11072  },};
11073 
11074 /* DeleteReferencesRequest */
11075 static UA_DataTypeMember DeleteReferencesRequest_members[2] = {
11077 #ifdef UA_ENABLE_TYPENAMES
11078  .memberName = "requestHeader",
11079 #endif
11080  .namespaceZero = true,
11081  .padding = 0,
11082  .isArray = false
11083  },
11084  { .memberTypeIndex = UA_TYPES_DELETEREFERENCESITEM,
11085 #ifdef UA_ENABLE_TYPENAMES
11086  .memberName = "referencesToDelete",
11087 #endif
11088  .namespaceZero = true,
11089  .padding = offsetof(UA_DeleteReferencesRequest, referencesToDeleteSize) - offsetof(UA_DeleteReferencesRequest, requestHeader) - sizeof(UA_RequestHeader),
11090  .isArray = true
11091  },};
11092 
11093 /* ModifyMonitoredItemsResponse */
11094 static UA_DataTypeMember ModifyMonitoredItemsResponse_members[3] = {
11096 #ifdef UA_ENABLE_TYPENAMES
11097  .memberName = "responseHeader",
11098 #endif
11099  .namespaceZero = true,
11100  .padding = 0,
11101  .isArray = false
11102  },
11103  { .memberTypeIndex = UA_TYPES_MONITOREDITEMMODIFYRESULT,
11104 #ifdef UA_ENABLE_TYPENAMES
11105  .memberName = "results",
11106 #endif
11107  .namespaceZero = true,
11108  .padding = offsetof(UA_ModifyMonitoredItemsResponse, resultsSize) - offsetof(UA_ModifyMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11109  .isArray = true
11110  },
11111  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11112 #ifdef UA_ENABLE_TYPENAMES
11113  .memberName = "diagnosticInfos",
11114 #endif
11115  .namespaceZero = true,
11116  .padding = offsetof(UA_ModifyMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_ModifyMonitoredItemsResponse, results) - sizeof(void*),
11117  .isArray = true
11118  },};
11119 
11120 /* ReadResponse */
11121 static UA_DataTypeMember ReadResponse_members[3] = {
11123 #ifdef UA_ENABLE_TYPENAMES
11124  .memberName = "responseHeader",
11125 #endif
11126  .namespaceZero = true,
11127  .padding = 0,
11128  .isArray = false
11129  },
11130  { .memberTypeIndex = UA_TYPES_DATAVALUE,
11131 #ifdef UA_ENABLE_TYPENAMES
11132  .memberName = "results",
11133 #endif
11134  .namespaceZero = true,
11135  .padding = offsetof(UA_ReadResponse, resultsSize) - offsetof(UA_ReadResponse, responseHeader) - sizeof(UA_ResponseHeader),
11136  .isArray = true
11137  },
11138  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11139 #ifdef UA_ENABLE_TYPENAMES
11140  .memberName = "diagnosticInfos",
11141 #endif
11142  .namespaceZero = true,
11143  .padding = offsetof(UA_ReadResponse, diagnosticInfosSize) - offsetof(UA_ReadResponse, results) - sizeof(void*),
11144  .isArray = true
11145  },};
11146 
11147 /* AddReferencesRequest */
11148 static UA_DataTypeMember AddReferencesRequest_members[2] = {
11150 #ifdef UA_ENABLE_TYPENAMES
11151  .memberName = "requestHeader",
11152 #endif
11153  .namespaceZero = true,
11154  .padding = 0,
11155  .isArray = false
11156  },
11157  { .memberTypeIndex = UA_TYPES_ADDREFERENCESITEM,
11158 #ifdef UA_ENABLE_TYPENAMES
11159  .memberName = "referencesToAdd",
11160 #endif
11161  .namespaceZero = true,
11162  .padding = offsetof(UA_AddReferencesRequest, referencesToAddSize) - offsetof(UA_AddReferencesRequest, requestHeader) - sizeof(UA_RequestHeader),
11163  .isArray = true
11164  },};
11165 
11166 /* ReadRequest */
11167 static UA_DataTypeMember ReadRequest_members[4] = {
11169 #ifdef UA_ENABLE_TYPENAMES
11170  .memberName = "requestHeader",
11171 #endif
11172  .namespaceZero = true,
11173  .padding = 0,
11174  .isArray = false
11175  },
11176  { .memberTypeIndex = UA_TYPES_DOUBLE,
11177 #ifdef UA_ENABLE_TYPENAMES
11178  .memberName = "maxAge",
11179 #endif
11180  .namespaceZero = true,
11181  .padding = offsetof(UA_ReadRequest, maxAge) - offsetof(UA_ReadRequest, requestHeader) - sizeof(UA_RequestHeader),
11182  .isArray = false
11183  },
11184  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
11185 #ifdef UA_ENABLE_TYPENAMES
11186  .memberName = "timestampsToReturn",
11187 #endif
11188  .namespaceZero = true,
11189  .padding = offsetof(UA_ReadRequest, timestampsToReturn) - offsetof(UA_ReadRequest, maxAge) - sizeof(UA_Double),
11190  .isArray = false
11191  },
11192  { .memberTypeIndex = UA_TYPES_READVALUEID,
11193 #ifdef UA_ENABLE_TYPENAMES
11194  .memberName = "nodesToRead",
11195 #endif
11196  .namespaceZero = true,
11197  .padding = offsetof(UA_ReadRequest, nodesToReadSize) - offsetof(UA_ReadRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
11198  .isArray = true
11199  },};
11200 
11201 /* AddNodesItem */
11202 static UA_DataTypeMember AddNodesItem_members[7] = {
11204 #ifdef UA_ENABLE_TYPENAMES
11205  .memberName = "parentNodeId",
11206 #endif
11207  .namespaceZero = true,
11208  .padding = 0,
11209  .isArray = false
11210  },
11211  { .memberTypeIndex = UA_TYPES_NODEID,
11212 #ifdef UA_ENABLE_TYPENAMES
11213  .memberName = "referenceTypeId",
11214 #endif
11215  .namespaceZero = true,
11216  .padding = offsetof(UA_AddNodesItem, referenceTypeId) - offsetof(UA_AddNodesItem, parentNodeId) - sizeof(UA_ExpandedNodeId),
11217  .isArray = false
11218  },
11219  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
11220 #ifdef UA_ENABLE_TYPENAMES
11221  .memberName = "requestedNewNodeId",
11222 #endif
11223  .namespaceZero = true,
11224  .padding = offsetof(UA_AddNodesItem, requestedNewNodeId) - offsetof(UA_AddNodesItem, referenceTypeId) - sizeof(UA_NodeId),
11225  .isArray = false
11226  },
11227  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
11228 #ifdef UA_ENABLE_TYPENAMES
11229  .memberName = "browseName",
11230 #endif
11231  .namespaceZero = true,
11232  .padding = offsetof(UA_AddNodesItem, browseName) - offsetof(UA_AddNodesItem, requestedNewNodeId) - sizeof(UA_ExpandedNodeId),
11233  .isArray = false
11234  },
11235  { .memberTypeIndex = UA_TYPES_NODECLASS,
11236 #ifdef UA_ENABLE_TYPENAMES
11237  .memberName = "nodeClass",
11238 #endif
11239  .namespaceZero = true,
11240  .padding = offsetof(UA_AddNodesItem, nodeClass) - offsetof(UA_AddNodesItem, browseName) - sizeof(UA_QualifiedName),
11241  .isArray = false
11242  },
11243  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
11244 #ifdef UA_ENABLE_TYPENAMES
11245  .memberName = "nodeAttributes",
11246 #endif
11247  .namespaceZero = true,
11248  .padding = offsetof(UA_AddNodesItem, nodeAttributes) - offsetof(UA_AddNodesItem, nodeClass) - sizeof(UA_NodeClass),
11249  .isArray = false
11250  },
11251  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
11252 #ifdef UA_ENABLE_TYPENAMES
11253  .memberName = "typeDefinition",
11254 #endif
11255  .namespaceZero = true,
11256  .padding = offsetof(UA_AddNodesItem, typeDefinition) - offsetof(UA_AddNodesItem, nodeAttributes) - sizeof(UA_ExtensionObject),
11257  .isArray = false
11258  },};
11259 
11260 /* ServerStatusDataType */
11261 static UA_DataTypeMember ServerStatusDataType_members[6] = {
11263 #ifdef UA_ENABLE_TYPENAMES
11264  .memberName = "startTime",
11265 #endif
11266  .namespaceZero = true,
11267  .padding = 0,
11268  .isArray = false
11269  },
11270  { .memberTypeIndex = UA_TYPES_DATETIME,
11271 #ifdef UA_ENABLE_TYPENAMES
11272  .memberName = "currentTime",
11273 #endif
11274  .namespaceZero = true,
11275  .padding = offsetof(UA_ServerStatusDataType, currentTime) - offsetof(UA_ServerStatusDataType, startTime) - sizeof(UA_DateTime),
11276  .isArray = false
11277  },
11278  { .memberTypeIndex = UA_TYPES_SERVERSTATE,
11279 #ifdef UA_ENABLE_TYPENAMES
11280  .memberName = "state",
11281 #endif
11282  .namespaceZero = true,
11283  .padding = offsetof(UA_ServerStatusDataType, state) - offsetof(UA_ServerStatusDataType, currentTime) - sizeof(UA_DateTime),
11284  .isArray = false
11285  },
11286  { .memberTypeIndex = UA_TYPES_BUILDINFO,
11287 #ifdef UA_ENABLE_TYPENAMES
11288  .memberName = "buildInfo",
11289 #endif
11290  .namespaceZero = true,
11291  .padding = offsetof(UA_ServerStatusDataType, buildInfo) - offsetof(UA_ServerStatusDataType, state) - sizeof(UA_ServerState),
11292  .isArray = false
11293  },
11294  { .memberTypeIndex = UA_TYPES_UINT32,
11295 #ifdef UA_ENABLE_TYPENAMES
11296  .memberName = "secondsTillShutdown",
11297 #endif
11298  .namespaceZero = true,
11299  .padding = offsetof(UA_ServerStatusDataType, secondsTillShutdown) - offsetof(UA_ServerStatusDataType, buildInfo) - sizeof(UA_BuildInfo),
11300  .isArray = false
11301  },
11302  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
11303 #ifdef UA_ENABLE_TYPENAMES
11304  .memberName = "shutdownReason",
11305 #endif
11306  .namespaceZero = true,
11307  .padding = offsetof(UA_ServerStatusDataType, shutdownReason) - offsetof(UA_ServerStatusDataType, secondsTillShutdown) - sizeof(UA_UInt32),
11308  .isArray = false
11309  },};
11310 
11311 /* AddReferencesResponse */
11312 static UA_DataTypeMember AddReferencesResponse_members[3] = {
11314 #ifdef UA_ENABLE_TYPENAMES
11315  .memberName = "responseHeader",
11316 #endif
11317  .namespaceZero = true,
11318  .padding = 0,
11319  .isArray = false
11320  },
11321  { .memberTypeIndex = UA_TYPES_STATUSCODE,
11322 #ifdef UA_ENABLE_TYPENAMES
11323  .memberName = "results",
11324 #endif
11325  .namespaceZero = true,
11326  .padding = offsetof(UA_AddReferencesResponse, resultsSize) - offsetof(UA_AddReferencesResponse, responseHeader) - sizeof(UA_ResponseHeader),
11327  .isArray = true
11328  },
11329  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11330 #ifdef UA_ENABLE_TYPENAMES
11331  .memberName = "diagnosticInfos",
11332 #endif
11333  .namespaceZero = true,
11334  .padding = offsetof(UA_AddReferencesResponse, diagnosticInfosSize) - offsetof(UA_AddReferencesResponse, results) - sizeof(void*),
11335  .isArray = true
11336  },};
11337 
11338 /* TranslateBrowsePathsToNodeIdsResponse */
11339 static UA_DataTypeMember TranslateBrowsePathsToNodeIdsResponse_members[3] = {
11341 #ifdef UA_ENABLE_TYPENAMES
11342  .memberName = "responseHeader",
11343 #endif
11344  .namespaceZero = true,
11345  .padding = 0,
11346  .isArray = false
11347  },
11348  { .memberTypeIndex = UA_TYPES_BROWSEPATHRESULT,
11349 #ifdef UA_ENABLE_TYPENAMES
11350  .memberName = "results",
11351 #endif
11352  .namespaceZero = true,
11353  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, resultsSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11354  .isArray = true
11355  },
11356  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11357 #ifdef UA_ENABLE_TYPENAMES
11358  .memberName = "diagnosticInfos",
11359 #endif
11360  .namespaceZero = true,
11361  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, diagnosticInfosSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, results) - sizeof(void*),
11362  .isArray = true
11363  },};
11364 
11365 /* DataChangeFilter */
11366 static UA_DataTypeMember DataChangeFilter_members[3] = {
11368 #ifdef UA_ENABLE_TYPENAMES
11369  .memberName = "trigger",
11370 #endif
11371  .namespaceZero = true,
11372  .padding = 0,
11373  .isArray = false
11374  },
11375  { .memberTypeIndex = UA_TYPES_UINT32,
11376 #ifdef UA_ENABLE_TYPENAMES
11377  .memberName = "deadbandType",
11378 #endif
11379  .namespaceZero = true,
11380  .padding = offsetof(UA_DataChangeFilter, deadbandType) - offsetof(UA_DataChangeFilter, trigger) - sizeof(UA_DataChangeTrigger),
11381  .isArray = false
11382  },
11383  { .memberTypeIndex = UA_TYPES_DOUBLE,
11384 #ifdef UA_ENABLE_TYPENAMES
11385  .memberName = "deadbandValue",
11386 #endif
11387  .namespaceZero = true,
11388  .padding = offsetof(UA_DataChangeFilter, deadbandValue) - offsetof(UA_DataChangeFilter, deadbandType) - sizeof(UA_UInt32),
11389  .isArray = false
11390  },};
11391 
11392 /* ContentFilterElement */
11393 static UA_DataTypeMember ContentFilterElement_members[2] = {
11395 #ifdef UA_ENABLE_TYPENAMES
11396  .memberName = "filterOperator",
11397 #endif
11398  .namespaceZero = true,
11399  .padding = 0,
11400  .isArray = false
11401  },
11402  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
11403 #ifdef UA_ENABLE_TYPENAMES
11404  .memberName = "filterOperands",
11405 #endif
11406  .namespaceZero = true,
11407  .padding = offsetof(UA_ContentFilterElement, filterOperandsSize) - offsetof(UA_ContentFilterElement, filterOperator) - sizeof(UA_FilterOperator),
11408  .isArray = true
11409  },};
11410 
11411 /* CloseSessionResponse */
11412 static UA_DataTypeMember CloseSessionResponse_members[1] = {
11414 #ifdef UA_ENABLE_TYPENAMES
11415  .memberName = "responseHeader",
11416 #endif
11417  .namespaceZero = true,
11418  .padding = 0,
11419  .isArray = false
11420  },};
11421 
11422 /* ApplicationDescription */
11423 static UA_DataTypeMember ApplicationDescription_members[7] = {
11425 #ifdef UA_ENABLE_TYPENAMES
11426  .memberName = "applicationUri",
11427 #endif
11428  .namespaceZero = true,
11429  .padding = 0,
11430  .isArray = false
11431  },
11432  { .memberTypeIndex = UA_TYPES_STRING,
11433 #ifdef UA_ENABLE_TYPENAMES
11434  .memberName = "productUri",
11435 #endif
11436  .namespaceZero = true,
11437  .padding = offsetof(UA_ApplicationDescription, productUri) - offsetof(UA_ApplicationDescription, applicationUri) - sizeof(UA_String),
11438  .isArray = false
11439  },
11440  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
11441 #ifdef UA_ENABLE_TYPENAMES
11442  .memberName = "applicationName",
11443 #endif
11444  .namespaceZero = true,
11445  .padding = offsetof(UA_ApplicationDescription, applicationName) - offsetof(UA_ApplicationDescription, productUri) - sizeof(UA_String),
11446  .isArray = false
11447  },
11448  { .memberTypeIndex = UA_TYPES_APPLICATIONTYPE,
11449 #ifdef UA_ENABLE_TYPENAMES
11450  .memberName = "applicationType",
11451 #endif
11452  .namespaceZero = true,
11453  .padding = offsetof(UA_ApplicationDescription, applicationType) - offsetof(UA_ApplicationDescription, applicationName) - sizeof(UA_LocalizedText),
11454  .isArray = false
11455  },
11456  { .memberTypeIndex = UA_TYPES_STRING,
11457 #ifdef UA_ENABLE_TYPENAMES
11458  .memberName = "gatewayServerUri",
11459 #endif
11460  .namespaceZero = true,
11461  .padding = offsetof(UA_ApplicationDescription, gatewayServerUri) - offsetof(UA_ApplicationDescription, applicationType) - sizeof(UA_ApplicationType),
11462  .isArray = false
11463  },
11464  { .memberTypeIndex = UA_TYPES_STRING,
11465 #ifdef UA_ENABLE_TYPENAMES
11466  .memberName = "discoveryProfileUri",
11467 #endif
11468  .namespaceZero = true,
11469  .padding = offsetof(UA_ApplicationDescription, discoveryProfileUri) - offsetof(UA_ApplicationDescription, gatewayServerUri) - sizeof(UA_String),
11470  .isArray = false
11471  },
11472  { .memberTypeIndex = UA_TYPES_STRING,
11473 #ifdef UA_ENABLE_TYPENAMES
11474  .memberName = "discoveryUrls",
11475 #endif
11476  .namespaceZero = true,
11477  .padding = offsetof(UA_ApplicationDescription, discoveryUrlsSize) - offsetof(UA_ApplicationDescription, discoveryProfileUri) - sizeof(UA_String),
11478  .isArray = true
11479  },};
11480 
11481 /* ServiceFault */
11482 static UA_DataTypeMember ServiceFault_members[1] = {
11484 #ifdef UA_ENABLE_TYPENAMES
11485  .memberName = "responseHeader",
11486 #endif
11487  .namespaceZero = true,
11488  .padding = 0,
11489  .isArray = false
11490  },};
11491 
11492 /* FindServersResponse */
11493 static UA_DataTypeMember FindServersResponse_members[2] = {
11495 #ifdef UA_ENABLE_TYPENAMES
11496  .memberName = "responseHeader",
11497 #endif
11498  .namespaceZero = true,
11499  .padding = 0,
11500  .isArray = false
11501  },
11502  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11503 #ifdef UA_ENABLE_TYPENAMES
11504  .memberName = "servers",
11505 #endif
11506  .namespaceZero = true,
11507  .padding = offsetof(UA_FindServersResponse, serversSize) - offsetof(UA_FindServersResponse, responseHeader) - sizeof(UA_ResponseHeader),
11508  .isArray = true
11509  },};
11510 
11511 /* CreateMonitoredItemsRequest */
11512 static UA_DataTypeMember CreateMonitoredItemsRequest_members[4] = {
11514 #ifdef UA_ENABLE_TYPENAMES
11515  .memberName = "requestHeader",
11516 #endif
11517  .namespaceZero = true,
11518  .padding = 0,
11519  .isArray = false
11520  },
11521  { .memberTypeIndex = UA_TYPES_UINT32,
11522 #ifdef UA_ENABLE_TYPENAMES
11523  .memberName = "subscriptionId",
11524 #endif
11525  .namespaceZero = true,
11526  .padding = offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - offsetof(UA_CreateMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
11527  .isArray = false
11528  },
11529  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
11530 #ifdef UA_ENABLE_TYPENAMES
11531  .memberName = "timestampsToReturn",
11532 #endif
11533  .namespaceZero = true,
11534  .padding = offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
11535  .isArray = false
11536  },
11537  { .memberTypeIndex = UA_TYPES_MONITOREDITEMCREATEREQUEST,
11538 #ifdef UA_ENABLE_TYPENAMES
11539  .memberName = "itemsToCreate",
11540 #endif
11541  .namespaceZero = true,
11542  .padding = offsetof(UA_CreateMonitoredItemsRequest, itemsToCreateSize) - offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
11543  .isArray = true
11544  },};
11545 
11546 /* ContentFilter */
11547 static UA_DataTypeMember ContentFilter_members[1] = {
11549 #ifdef UA_ENABLE_TYPENAMES
11550  .memberName = "elements",
11551 #endif
11552  .namespaceZero = true,
11553  .padding = 0,
11554  .isArray = true
11555  },};
11556 
11557 /* QueryFirstResponse */
11558 static UA_DataTypeMember QueryFirstResponse_members[6] = {
11560 #ifdef UA_ENABLE_TYPENAMES
11561  .memberName = "responseHeader",
11562 #endif
11563  .namespaceZero = true,
11564  .padding = 0,
11565  .isArray = false
11566  },
11567  { .memberTypeIndex = UA_TYPES_QUERYDATASET,
11568 #ifdef UA_ENABLE_TYPENAMES
11569  .memberName = "queryDataSets",
11570 #endif
11571  .namespaceZero = true,
11572  .padding = offsetof(UA_QueryFirstResponse, queryDataSetsSize) - offsetof(UA_QueryFirstResponse, responseHeader) - sizeof(UA_ResponseHeader),
11573  .isArray = true
11574  },
11575  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11576 #ifdef UA_ENABLE_TYPENAMES
11577  .memberName = "continuationPoint",
11578 #endif
11579  .namespaceZero = true,
11580  .padding = offsetof(UA_QueryFirstResponse, continuationPoint) - offsetof(UA_QueryFirstResponse, queryDataSets) - sizeof(void*),
11581  .isArray = false
11582  },
11583  { .memberTypeIndex = UA_TYPES_PARSINGRESULT,
11584 #ifdef UA_ENABLE_TYPENAMES
11585  .memberName = "parsingResults",
11586 #endif
11587  .namespaceZero = true,
11588  .padding = offsetof(UA_QueryFirstResponse, parsingResultsSize) - offsetof(UA_QueryFirstResponse, continuationPoint) - sizeof(UA_ByteString),
11589  .isArray = true
11590  },
11591  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11592 #ifdef UA_ENABLE_TYPENAMES
11593  .memberName = "diagnosticInfos",
11594 #endif
11595  .namespaceZero = true,
11596  .padding = offsetof(UA_QueryFirstResponse, diagnosticInfosSize) - offsetof(UA_QueryFirstResponse, parsingResults) - sizeof(void*),
11597  .isArray = true
11598  },
11599  { .memberTypeIndex = UA_TYPES_CONTENTFILTERRESULT,
11600 #ifdef UA_ENABLE_TYPENAMES
11601  .memberName = "filterResult",
11602 #endif
11603  .namespaceZero = true,
11604  .padding = offsetof(UA_QueryFirstResponse, filterResult) - offsetof(UA_QueryFirstResponse, diagnosticInfos) - sizeof(void*),
11605  .isArray = false
11606  },};
11607 
11608 /* AddNodesRequest */
11609 static UA_DataTypeMember AddNodesRequest_members[2] = {
11611 #ifdef UA_ENABLE_TYPENAMES
11612  .memberName = "requestHeader",
11613 #endif
11614  .namespaceZero = true,
11615  .padding = 0,
11616  .isArray = false
11617  },
11618  { .memberTypeIndex = UA_TYPES_ADDNODESITEM,
11619 #ifdef UA_ENABLE_TYPENAMES
11620  .memberName = "nodesToAdd",
11621 #endif
11622  .namespaceZero = true,
11623  .padding = offsetof(UA_AddNodesRequest, nodesToAddSize) - offsetof(UA_AddNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
11624  .isArray = true
11625  },};
11626 
11627 /* BrowseRequest */
11628 static UA_DataTypeMember BrowseRequest_members[4] = {
11630 #ifdef UA_ENABLE_TYPENAMES
11631  .memberName = "requestHeader",
11632 #endif
11633  .namespaceZero = true,
11634  .padding = 0,
11635  .isArray = false
11636  },
11637  { .memberTypeIndex = UA_TYPES_VIEWDESCRIPTION,
11638 #ifdef UA_ENABLE_TYPENAMES
11639  .memberName = "view",
11640 #endif
11641  .namespaceZero = true,
11642  .padding = offsetof(UA_BrowseRequest, view) - offsetof(UA_BrowseRequest, requestHeader) - sizeof(UA_RequestHeader),
11643  .isArray = false
11644  },
11645  { .memberTypeIndex = UA_TYPES_UINT32,
11646 #ifdef UA_ENABLE_TYPENAMES
11647  .memberName = "requestedMaxReferencesPerNode",
11648 #endif
11649  .namespaceZero = true,
11650  .padding = offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - offsetof(UA_BrowseRequest, view) - sizeof(UA_ViewDescription),
11651  .isArray = false
11652  },
11653  { .memberTypeIndex = UA_TYPES_BROWSEDESCRIPTION,
11654 #ifdef UA_ENABLE_TYPENAMES
11655  .memberName = "nodesToBrowse",
11656 #endif
11657  .namespaceZero = true,
11658  .padding = offsetof(UA_BrowseRequest, nodesToBrowseSize) - offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - sizeof(UA_UInt32),
11659  .isArray = true
11660  },};
11661 
11662 /* BrowsePath */
11663 static UA_DataTypeMember BrowsePath_members[2] = {
11665 #ifdef UA_ENABLE_TYPENAMES
11666  .memberName = "startingNode",
11667 #endif
11668  .namespaceZero = true,
11669  .padding = 0,
11670  .isArray = false
11671  },
11672  { .memberTypeIndex = UA_TYPES_RELATIVEPATH,
11673 #ifdef UA_ENABLE_TYPENAMES
11674  .memberName = "relativePath",
11675 #endif
11676  .namespaceZero = true,
11677  .padding = offsetof(UA_BrowsePath, relativePath) - offsetof(UA_BrowsePath, startingNode) - sizeof(UA_NodeId),
11678  .isArray = false
11679  },};
11680 
11681 /* BrowseResult */
11682 static UA_DataTypeMember BrowseResult_members[3] = {
11684 #ifdef UA_ENABLE_TYPENAMES
11685  .memberName = "statusCode",
11686 #endif
11687  .namespaceZero = true,
11688  .padding = 0,
11689  .isArray = false
11690  },
11691  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11692 #ifdef UA_ENABLE_TYPENAMES
11693  .memberName = "continuationPoint",
11694 #endif
11695  .namespaceZero = true,
11696  .padding = offsetof(UA_BrowseResult, continuationPoint) - offsetof(UA_BrowseResult, statusCode) - sizeof(UA_StatusCode),
11697  .isArray = false
11698  },
11699  { .memberTypeIndex = UA_TYPES_REFERENCEDESCRIPTION,
11700 #ifdef UA_ENABLE_TYPENAMES
11701  .memberName = "references",
11702 #endif
11703  .namespaceZero = true,
11704  .padding = offsetof(UA_BrowseResult, referencesSize) - offsetof(UA_BrowseResult, continuationPoint) - sizeof(UA_ByteString),
11705  .isArray = true
11706  },};
11707 
11708 /* CreateSessionRequest */
11709 static UA_DataTypeMember CreateSessionRequest_members[9] = {
11711 #ifdef UA_ENABLE_TYPENAMES
11712  .memberName = "requestHeader",
11713 #endif
11714  .namespaceZero = true,
11715  .padding = 0,
11716  .isArray = false
11717  },
11718  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11719 #ifdef UA_ENABLE_TYPENAMES
11720  .memberName = "clientDescription",
11721 #endif
11722  .namespaceZero = true,
11723  .padding = offsetof(UA_CreateSessionRequest, clientDescription) - offsetof(UA_CreateSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
11724  .isArray = false
11725  },
11726  { .memberTypeIndex = UA_TYPES_STRING,
11727 #ifdef UA_ENABLE_TYPENAMES
11728  .memberName = "serverUri",
11729 #endif
11730  .namespaceZero = true,
11731  .padding = offsetof(UA_CreateSessionRequest, serverUri) - offsetof(UA_CreateSessionRequest, clientDescription) - sizeof(UA_ApplicationDescription),
11732  .isArray = false
11733  },
11734  { .memberTypeIndex = UA_TYPES_STRING,
11735 #ifdef UA_ENABLE_TYPENAMES
11736  .memberName = "endpointUrl",
11737 #endif
11738  .namespaceZero = true,
11739  .padding = offsetof(UA_CreateSessionRequest, endpointUrl) - offsetof(UA_CreateSessionRequest, serverUri) - sizeof(UA_String),
11740  .isArray = false
11741  },
11742  { .memberTypeIndex = UA_TYPES_STRING,
11743 #ifdef UA_ENABLE_TYPENAMES
11744  .memberName = "sessionName",
11745 #endif
11746  .namespaceZero = true,
11747  .padding = offsetof(UA_CreateSessionRequest, sessionName) - offsetof(UA_CreateSessionRequest, endpointUrl) - sizeof(UA_String),
11748  .isArray = false
11749  },
11750  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11751 #ifdef UA_ENABLE_TYPENAMES
11752  .memberName = "clientNonce",
11753 #endif
11754  .namespaceZero = true,
11755  .padding = offsetof(UA_CreateSessionRequest, clientNonce) - offsetof(UA_CreateSessionRequest, sessionName) - sizeof(UA_String),
11756  .isArray = false
11757  },
11758  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11759 #ifdef UA_ENABLE_TYPENAMES
11760  .memberName = "clientCertificate",
11761 #endif
11762  .namespaceZero = true,
11763  .padding = offsetof(UA_CreateSessionRequest, clientCertificate) - offsetof(UA_CreateSessionRequest, clientNonce) - sizeof(UA_ByteString),
11764  .isArray = false
11765  },
11766  { .memberTypeIndex = UA_TYPES_DOUBLE,
11767 #ifdef UA_ENABLE_TYPENAMES
11768  .memberName = "requestedSessionTimeout",
11769 #endif
11770  .namespaceZero = true,
11771  .padding = offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - offsetof(UA_CreateSessionRequest, clientCertificate) - sizeof(UA_ByteString),
11772  .isArray = false
11773  },
11774  { .memberTypeIndex = UA_TYPES_UINT32,
11775 #ifdef UA_ENABLE_TYPENAMES
11776  .memberName = "maxResponseMessageSize",
11777 #endif
11778  .namespaceZero = true,
11779  .padding = offsetof(UA_CreateSessionRequest, maxResponseMessageSize) - offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - sizeof(UA_Double),
11780  .isArray = false
11781  },};
11782 
11783 /* QueryDataDescription */
11784 static UA_DataTypeMember QueryDataDescription_members[3] = {
11786 #ifdef UA_ENABLE_TYPENAMES
11787  .memberName = "relativePath",
11788 #endif
11789  .namespaceZero = true,
11790  .padding = 0,
11791  .isArray = false
11792  },
11793  { .memberTypeIndex = UA_TYPES_UINT32,
11794 #ifdef UA_ENABLE_TYPENAMES
11795  .memberName = "attributeId",
11796 #endif
11797  .namespaceZero = true,
11798  .padding = offsetof(UA_QueryDataDescription, attributeId) - offsetof(UA_QueryDataDescription, relativePath) - sizeof(UA_RelativePath),
11799  .isArray = false
11800  },
11801  { .memberTypeIndex = UA_TYPES_STRING,
11802 #ifdef UA_ENABLE_TYPENAMES
11803  .memberName = "indexRange",
11804 #endif
11805  .namespaceZero = true,
11806  .padding = offsetof(UA_QueryDataDescription, indexRange) - offsetof(UA_QueryDataDescription, attributeId) - sizeof(UA_UInt32),
11807  .isArray = false
11808  },};
11809 
11810 /* EndpointDescription */
11811 static UA_DataTypeMember EndpointDescription_members[8] = {
11813 #ifdef UA_ENABLE_TYPENAMES
11814  .memberName = "endpointUrl",
11815 #endif
11816  .namespaceZero = true,
11817  .padding = 0,
11818  .isArray = false
11819  },
11820  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11821 #ifdef UA_ENABLE_TYPENAMES
11822  .memberName = "server",
11823 #endif
11824  .namespaceZero = true,
11825  .padding = offsetof(UA_EndpointDescription, server) - offsetof(UA_EndpointDescription, endpointUrl) - sizeof(UA_String),
11826  .isArray = false
11827  },
11828  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11829 #ifdef UA_ENABLE_TYPENAMES
11830  .memberName = "serverCertificate",
11831 #endif
11832  .namespaceZero = true,
11833  .padding = offsetof(UA_EndpointDescription, serverCertificate) - offsetof(UA_EndpointDescription, server) - sizeof(UA_ApplicationDescription),
11834  .isArray = false
11835  },
11836  { .memberTypeIndex = UA_TYPES_MESSAGESECURITYMODE,
11837 #ifdef UA_ENABLE_TYPENAMES
11838  .memberName = "securityMode",
11839 #endif
11840  .namespaceZero = true,
11841  .padding = offsetof(UA_EndpointDescription, securityMode) - offsetof(UA_EndpointDescription, serverCertificate) - sizeof(UA_ByteString),
11842  .isArray = false
11843  },
11844  { .memberTypeIndex = UA_TYPES_STRING,
11845 #ifdef UA_ENABLE_TYPENAMES
11846  .memberName = "securityPolicyUri",
11847 #endif
11848  .namespaceZero = true,
11849  .padding = offsetof(UA_EndpointDescription, securityPolicyUri) - offsetof(UA_EndpointDescription, securityMode) - sizeof(UA_MessageSecurityMode),
11850  .isArray = false
11851  },
11852  { .memberTypeIndex = UA_TYPES_USERTOKENPOLICY,
11853 #ifdef UA_ENABLE_TYPENAMES
11854  .memberName = "userIdentityTokens",
11855 #endif
11856  .namespaceZero = true,
11857  .padding = offsetof(UA_EndpointDescription, userIdentityTokensSize) - offsetof(UA_EndpointDescription, securityPolicyUri) - sizeof(UA_String),
11858  .isArray = true
11859  },
11860  { .memberTypeIndex = UA_TYPES_STRING,
11861 #ifdef UA_ENABLE_TYPENAMES
11862  .memberName = "transportProfileUri",
11863 #endif
11864  .namespaceZero = true,
11865  .padding = offsetof(UA_EndpointDescription, transportProfileUri) - offsetof(UA_EndpointDescription, userIdentityTokens) - sizeof(void*),
11866  .isArray = false
11867  },
11868  { .memberTypeIndex = UA_TYPES_BYTE,
11869 #ifdef UA_ENABLE_TYPENAMES
11870  .memberName = "securityLevel",
11871 #endif
11872  .namespaceZero = true,
11873  .padding = offsetof(UA_EndpointDescription, securityLevel) - offsetof(UA_EndpointDescription, transportProfileUri) - sizeof(UA_String),
11874  .isArray = false
11875  },};
11876 
11877 /* GetEndpointsResponse */
11878 static UA_DataTypeMember GetEndpointsResponse_members[2] = {
11880 #ifdef UA_ENABLE_TYPENAMES
11881  .memberName = "responseHeader",
11882 #endif
11883  .namespaceZero = true,
11884  .padding = 0,
11885  .isArray = false
11886  },
11887  { .memberTypeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
11888 #ifdef UA_ENABLE_TYPENAMES
11889  .memberName = "endpoints",
11890 #endif
11891  .namespaceZero = true,
11892  .padding = offsetof(UA_GetEndpointsResponse, endpointsSize) - offsetof(UA_GetEndpointsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11893  .isArray = true
11894  },};
11895 
11896 /* NodeTypeDescription */
11897 static UA_DataTypeMember NodeTypeDescription_members[3] = {
11899 #ifdef UA_ENABLE_TYPENAMES
11900  .memberName = "typeDefinitionNode",
11901 #endif
11902  .namespaceZero = true,
11903  .padding = 0,
11904  .isArray = false
11905  },
11906  { .memberTypeIndex = UA_TYPES_BOOLEAN,
11907 #ifdef UA_ENABLE_TYPENAMES
11908  .memberName = "includeSubTypes",
11909 #endif
11910  .namespaceZero = true,
11911  .padding = offsetof(UA_NodeTypeDescription, includeSubTypes) - offsetof(UA_NodeTypeDescription, typeDefinitionNode) - sizeof(UA_ExpandedNodeId),
11912  .isArray = false
11913  },
11914  { .memberTypeIndex = UA_TYPES_QUERYDATADESCRIPTION,
11915 #ifdef UA_ENABLE_TYPENAMES
11916  .memberName = "dataToReturn",
11917 #endif
11918  .namespaceZero = true,
11919  .padding = offsetof(UA_NodeTypeDescription, dataToReturnSize) - offsetof(UA_NodeTypeDescription, includeSubTypes) - sizeof(UA_Boolean),
11920  .isArray = true
11921  },};
11922 
11923 /* BrowseNextResponse */
11924 static UA_DataTypeMember BrowseNextResponse_members[3] = {
11926 #ifdef UA_ENABLE_TYPENAMES
11927  .memberName = "responseHeader",
11928 #endif
11929  .namespaceZero = true,
11930  .padding = 0,
11931  .isArray = false
11932  },
11933  { .memberTypeIndex = UA_TYPES_BROWSERESULT,
11934 #ifdef UA_ENABLE_TYPENAMES
11935  .memberName = "results",
11936 #endif
11937  .namespaceZero = true,
11938  .padding = offsetof(UA_BrowseNextResponse, resultsSize) - offsetof(UA_BrowseNextResponse, responseHeader) - sizeof(UA_ResponseHeader),
11939  .isArray = true
11940  },
11941  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11942 #ifdef UA_ENABLE_TYPENAMES
11943  .memberName = "diagnosticInfos",
11944 #endif
11945  .namespaceZero = true,
11946  .padding = offsetof(UA_BrowseNextResponse, diagnosticInfosSize) - offsetof(UA_BrowseNextResponse, results) - sizeof(void*),
11947  .isArray = true
11948  },};
11949 
11950 /* TranslateBrowsePathsToNodeIdsRequest */
11951 static UA_DataTypeMember TranslateBrowsePathsToNodeIdsRequest_members[2] = {
11953 #ifdef UA_ENABLE_TYPENAMES
11954  .memberName = "requestHeader",
11955 #endif
11956  .namespaceZero = true,
11957  .padding = 0,
11958  .isArray = false
11959  },
11960  { .memberTypeIndex = UA_TYPES_BROWSEPATH,
11961 #ifdef UA_ENABLE_TYPENAMES
11962  .memberName = "browsePaths",
11963 #endif
11964  .namespaceZero = true,
11965  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, browsePathsSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, requestHeader) - sizeof(UA_RequestHeader),
11966  .isArray = true
11967  },};
11968 
11969 /* BrowseResponse */
11970 static UA_DataTypeMember BrowseResponse_members[3] = {
11972 #ifdef UA_ENABLE_TYPENAMES
11973  .memberName = "responseHeader",
11974 #endif
11975  .namespaceZero = true,
11976  .padding = 0,
11977  .isArray = false
11978  },
11979  { .memberTypeIndex = UA_TYPES_BROWSERESULT,
11980 #ifdef UA_ENABLE_TYPENAMES
11981  .memberName = "results",
11982 #endif
11983  .namespaceZero = true,
11984  .padding = offsetof(UA_BrowseResponse, resultsSize) - offsetof(UA_BrowseResponse, responseHeader) - sizeof(UA_ResponseHeader),
11985  .isArray = true
11986  },
11987  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11988 #ifdef UA_ENABLE_TYPENAMES
11989  .memberName = "diagnosticInfos",
11990 #endif
11991  .namespaceZero = true,
11992  .padding = offsetof(UA_BrowseResponse, diagnosticInfosSize) - offsetof(UA_BrowseResponse, results) - sizeof(void*),
11993  .isArray = true
11994  },};
11995 
11996 /* CreateSessionResponse */
11997 static UA_DataTypeMember CreateSessionResponse_members[10] = {
11999 #ifdef UA_ENABLE_TYPENAMES
12000  .memberName = "responseHeader",
12001 #endif
12002  .namespaceZero = true,
12003  .padding = 0,
12004  .isArray = false
12005  },
12006  { .memberTypeIndex = UA_TYPES_NODEID,
12007 #ifdef UA_ENABLE_TYPENAMES
12008  .memberName = "sessionId",
12009 #endif
12010  .namespaceZero = true,
12011  .padding = offsetof(UA_CreateSessionResponse, sessionId) - offsetof(UA_CreateSessionResponse, responseHeader) - sizeof(UA_ResponseHeader),
12012  .isArray = false
12013  },
12014  { .memberTypeIndex = UA_TYPES_NODEID,
12015 #ifdef UA_ENABLE_TYPENAMES
12016  .memberName = "authenticationToken",
12017 #endif
12018  .namespaceZero = true,
12019  .padding = offsetof(UA_CreateSessionResponse, authenticationToken) - offsetof(UA_CreateSessionResponse, sessionId) - sizeof(UA_NodeId),
12020  .isArray = false
12021  },
12022  { .memberTypeIndex = UA_TYPES_DOUBLE,
12023 #ifdef UA_ENABLE_TYPENAMES
12024  .memberName = "revisedSessionTimeout",
12025 #endif
12026  .namespaceZero = true,
12027  .padding = offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - offsetof(UA_CreateSessionResponse, authenticationToken) - sizeof(UA_NodeId),
12028  .isArray = false
12029  },
12030  { .memberTypeIndex = UA_TYPES_BYTESTRING,
12031 #ifdef UA_ENABLE_TYPENAMES
12032  .memberName = "serverNonce",
12033 #endif
12034  .namespaceZero = true,
12035  .padding = offsetof(UA_CreateSessionResponse, serverNonce) - offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - sizeof(UA_Double),
12036  .isArray = false
12037  },
12038  { .memberTypeIndex = UA_TYPES_BYTESTRING,
12039 #ifdef UA_ENABLE_TYPENAMES
12040  .memberName = "serverCertificate",
12041 #endif
12042  .namespaceZero = true,
12043  .padding = offsetof(UA_CreateSessionResponse, serverCertificate) - offsetof(UA_CreateSessionResponse, serverNonce) - sizeof(UA_ByteString),
12044  .isArray = false
12045  },
12046  { .memberTypeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
12047 #ifdef UA_ENABLE_TYPENAMES
12048  .memberName = "serverEndpoints",
12049 #endif
12050  .namespaceZero = true,
12051  .padding = offsetof(UA_CreateSessionResponse, serverEndpointsSize) - offsetof(UA_CreateSessionResponse, serverCertificate) - sizeof(UA_ByteString),
12052  .isArray = true
12053  },
12054  { .memberTypeIndex = UA_TYPES_SIGNEDSOFTWARECERTIFICATE,
12055 #ifdef UA_ENABLE_TYPENAMES
12056  .memberName = "serverSoftwareCertificates",
12057 #endif
12058  .namespaceZero = true,
12059  .padding = offsetof(UA_CreateSessionResponse, serverSoftwareCertificatesSize) - offsetof(UA_CreateSessionResponse, serverEndpoints) - sizeof(void*),
12060  .isArray = true
12061  },
12062  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
12063 #ifdef UA_ENABLE_TYPENAMES
12064  .memberName = "serverSignature",
12065 #endif
12066  .namespaceZero = true,
12067  .padding = offsetof(UA_CreateSessionResponse, serverSignature) - offsetof(UA_CreateSessionResponse, serverSoftwareCertificates) - sizeof(void*),
12068  .isArray = false
12069  },
12070  { .memberTypeIndex = UA_TYPES_UINT32,
12071 #ifdef UA_ENABLE_TYPENAMES
12072  .memberName = "maxRequestMessageSize",
12073 #endif
12074  .namespaceZero = true,
12075  .padding = offsetof(UA_CreateSessionResponse, maxRequestMessageSize) - offsetof(UA_CreateSessionResponse, serverSignature) - sizeof(UA_SignatureData),
12076  .isArray = false
12077  },};
12078 
12079 /* QueryFirstRequest */
12080 static UA_DataTypeMember QueryFirstRequest_members[6] = {
12082 #ifdef UA_ENABLE_TYPENAMES
12083  .memberName = "requestHeader",
12084 #endif
12085  .namespaceZero = true,
12086  .padding = 0,
12087  .isArray = false
12088  },
12089  { .memberTypeIndex = UA_TYPES_VIEWDESCRIPTION,
12090 #ifdef UA_ENABLE_TYPENAMES
12091  .memberName = "view",
12092 #endif
12093  .namespaceZero = true,
12094  .padding = offsetof(UA_QueryFirstRequest, view) - offsetof(UA_QueryFirstRequest, requestHeader) - sizeof(UA_RequestHeader),
12095  .isArray = false
12096  },
12097  { .memberTypeIndex = UA_TYPES_NODETYPEDESCRIPTION,
12098 #ifdef UA_ENABLE_TYPENAMES
12099  .memberName = "nodeTypes",
12100 #endif
12101  .namespaceZero = true,
12102  .padding = offsetof(UA_QueryFirstRequest, nodeTypesSize) - offsetof(UA_QueryFirstRequest, view) - sizeof(UA_ViewDescription),
12103  .isArray = true
12104  },
12105  { .memberTypeIndex = UA_TYPES_CONTENTFILTER,
12106 #ifdef UA_ENABLE_TYPENAMES
12107  .memberName = "filter",
12108 #endif
12109  .namespaceZero = true,
12110  .padding = offsetof(UA_QueryFirstRequest, filter) - offsetof(UA_QueryFirstRequest, nodeTypes) - sizeof(void*),
12111  .isArray = false
12112  },
12113  { .memberTypeIndex = UA_TYPES_UINT32,
12114 #ifdef UA_ENABLE_TYPENAMES
12115  .memberName = "maxDataSetsToReturn",
12116 #endif
12117  .namespaceZero = true,
12118  .padding = offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - offsetof(UA_QueryFirstRequest, filter) - sizeof(UA_ContentFilter),
12119  .isArray = false
12120  },
12121  { .memberTypeIndex = UA_TYPES_UINT32,
12122 #ifdef UA_ENABLE_TYPENAMES
12123  .memberName = "maxReferencesToReturn",
12124 #endif
12125  .namespaceZero = true,
12126  .padding = offsetof(UA_QueryFirstRequest, maxReferencesToReturn) - offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - sizeof(UA_UInt32),
12127  .isArray = false
12128  },};
12130 
12131 /* Boolean */
12132 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 1},
12133  .typeIndex = UA_TYPES_BOOLEAN,
12134 #ifdef UA_ENABLE_TYPENAMES
12135  .typeName = "Boolean",
12136 #endif
12137  .memSize = sizeof(UA_Boolean),
12138  .builtin = true,
12139  .fixedSize = true,
12140  .overlayable = true,
12141  .binaryEncodingId = 0,
12142  .membersSize = 1,
12143  .members = Boolean_members },
12144 
12145 /* SByte */
12146 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 2},
12147  .typeIndex = UA_TYPES_SBYTE,
12148 #ifdef UA_ENABLE_TYPENAMES
12149  .typeName = "SByte",
12150 #endif
12151  .memSize = sizeof(UA_SByte),
12152  .builtin = true,
12153  .fixedSize = true,
12154  .overlayable = true,
12155  .binaryEncodingId = 0,
12156  .membersSize = 1,
12157  .members = SByte_members },
12158 
12159 /* Byte */
12160 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 3},
12161  .typeIndex = UA_TYPES_BYTE,
12162 #ifdef UA_ENABLE_TYPENAMES
12163  .typeName = "Byte",
12164 #endif
12165  .memSize = sizeof(UA_Byte),
12166  .builtin = true,
12167  .fixedSize = true,
12168  .overlayable = true,
12169  .binaryEncodingId = 0,
12170  .membersSize = 1,
12171  .members = Byte_members },
12172 
12173 /* Int16 */
12174 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 4},
12175  .typeIndex = UA_TYPES_INT16,
12176 #ifdef UA_ENABLE_TYPENAMES
12177  .typeName = "Int16",
12178 #endif
12179  .memSize = sizeof(UA_Int16),
12180  .builtin = true,
12181  .fixedSize = true,
12182  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12183  .binaryEncodingId = 0,
12184  .membersSize = 1,
12185  .members = Int16_members },
12186 
12187 /* UInt16 */
12188 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 5},
12189  .typeIndex = UA_TYPES_UINT16,
12190 #ifdef UA_ENABLE_TYPENAMES
12191  .typeName = "UInt16",
12192 #endif
12193  .memSize = sizeof(UA_UInt16),
12194  .builtin = true,
12195  .fixedSize = true,
12196  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12197  .binaryEncodingId = 0,
12198  .membersSize = 1,
12199  .members = UInt16_members },
12200 
12201 /* Int32 */
12202 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12203  .typeIndex = UA_TYPES_INT32,
12204 #ifdef UA_ENABLE_TYPENAMES
12205  .typeName = "Int32",
12206 #endif
12207  .memSize = sizeof(UA_Int32),
12208  .builtin = true,
12209  .fixedSize = true,
12210  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12211  .binaryEncodingId = 0,
12212  .membersSize = 1,
12213  .members = Int32_members },
12214 
12215 /* UInt32 */
12216 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 7},
12217  .typeIndex = UA_TYPES_UINT32,
12218 #ifdef UA_ENABLE_TYPENAMES
12219  .typeName = "UInt32",
12220 #endif
12221  .memSize = sizeof(UA_UInt32),
12222  .builtin = true,
12223  .fixedSize = true,
12224  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12225  .binaryEncodingId = 0,
12226  .membersSize = 1,
12227  .members = UInt32_members },
12228 
12229 /* Int64 */
12230 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 8},
12231  .typeIndex = UA_TYPES_INT64,
12232 #ifdef UA_ENABLE_TYPENAMES
12233  .typeName = "Int64",
12234 #endif
12235  .memSize = sizeof(UA_Int64),
12236  .builtin = true,
12237  .fixedSize = true,
12238  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12239  .binaryEncodingId = 0,
12240  .membersSize = 1,
12241  .members = Int64_members },
12242 
12243 /* UInt64 */
12244 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 9},
12245  .typeIndex = UA_TYPES_UINT64,
12246 #ifdef UA_ENABLE_TYPENAMES
12247  .typeName = "UInt64",
12248 #endif
12249  .memSize = sizeof(UA_UInt64),
12250  .builtin = true,
12251  .fixedSize = true,
12252  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12253  .binaryEncodingId = 0,
12254  .membersSize = 1,
12255  .members = UInt64_members },
12256 
12257 /* Float */
12258 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 10},
12259  .typeIndex = UA_TYPES_FLOAT,
12260 #ifdef UA_ENABLE_TYPENAMES
12261  .typeName = "Float",
12262 #endif
12263  .memSize = sizeof(UA_Float),
12264  .builtin = true,
12265  .fixedSize = true,
12266  .overlayable = UA_BINARY_OVERLAYABLE_FLOAT,
12267  .binaryEncodingId = 0,
12268  .membersSize = 1,
12269  .members = Float_members },
12270 
12271 /* Double */
12272 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 11},
12273  .typeIndex = UA_TYPES_DOUBLE,
12274 #ifdef UA_ENABLE_TYPENAMES
12275  .typeName = "Double",
12276 #endif
12277  .memSize = sizeof(UA_Double),
12278  .builtin = true,
12279  .fixedSize = true,
12280  .overlayable = UA_BINARY_OVERLAYABLE_FLOAT,
12281  .binaryEncodingId = 0,
12282  .membersSize = 1,
12283  .members = Double_members },
12284 
12285 /* String */
12286 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 12},
12287  .typeIndex = UA_TYPES_STRING,
12288 #ifdef UA_ENABLE_TYPENAMES
12289  .typeName = "String",
12290 #endif
12291  .memSize = sizeof(UA_String),
12292  .builtin = true,
12293  .fixedSize = false,
12294  .overlayable = false,
12295  .binaryEncodingId = 0,
12296  .membersSize = 1,
12297  .members = String_members },
12298 
12299 /* DateTime */
12300 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 13},
12301  .typeIndex = UA_TYPES_DATETIME,
12302 #ifdef UA_ENABLE_TYPENAMES
12303  .typeName = "DateTime",
12304 #endif
12305  .memSize = sizeof(UA_DateTime),
12306  .builtin = true,
12307  .fixedSize = true,
12308  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12309  .binaryEncodingId = 0,
12310  .membersSize = 1,
12311  .members = DateTime_members },
12312 
12313 /* Guid */
12314 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 14},
12315  .typeIndex = UA_TYPES_GUID,
12316 #ifdef UA_ENABLE_TYPENAMES
12317  .typeName = "Guid",
12318 #endif
12319  .memSize = sizeof(UA_Guid),
12320  .builtin = true,
12321  .fixedSize = true,
12322  .overlayable = (UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_Guid, data2) == sizeof(UA_UInt32) && offsetof(UA_Guid, data3) == (sizeof(UA_UInt16) + sizeof(UA_UInt32)) && offsetof(UA_Guid, data4) == (2*sizeof(UA_UInt32))),
12323  .binaryEncodingId = 0,
12324  .membersSize = 1,
12325  .members = Guid_members },
12326 
12327 /* ByteString */
12328 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 15},
12329  .typeIndex = UA_TYPES_BYTESTRING,
12330 #ifdef UA_ENABLE_TYPENAMES
12331  .typeName = "ByteString",
12332 #endif
12333  .memSize = sizeof(UA_ByteString),
12334  .builtin = true,
12335  .fixedSize = false,
12336  .overlayable = false,
12337  .binaryEncodingId = 0,
12338  .membersSize = 1,
12339  .members = ByteString_members },
12340 
12341 /* XmlElement */
12342 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 16},
12343  .typeIndex = UA_TYPES_XMLELEMENT,
12344 #ifdef UA_ENABLE_TYPENAMES
12345  .typeName = "XmlElement",
12346 #endif
12347  .memSize = sizeof(UA_XmlElement),
12348  .builtin = true,
12349  .fixedSize = false,
12350  .overlayable = false,
12351  .binaryEncodingId = 0,
12352  .membersSize = 1,
12353  .members = XmlElement_members },
12354 
12355 /* NodeId */
12356 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 17},
12357  .typeIndex = UA_TYPES_NODEID,
12358 #ifdef UA_ENABLE_TYPENAMES
12359  .typeName = "NodeId",
12360 #endif
12361  .memSize = sizeof(UA_NodeId),
12362  .builtin = true,
12363  .fixedSize = false,
12364  .overlayable = false,
12365  .binaryEncodingId = 0,
12366  .membersSize = 1,
12367  .members = NodeId_members },
12368 
12369 /* ExpandedNodeId */
12370 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 18},
12371  .typeIndex = UA_TYPES_EXPANDEDNODEID,
12372 #ifdef UA_ENABLE_TYPENAMES
12373  .typeName = "ExpandedNodeId",
12374 #endif
12375  .memSize = sizeof(UA_ExpandedNodeId),
12376  .builtin = true,
12377  .fixedSize = false,
12378  .overlayable = false,
12379  .binaryEncodingId = 0,
12380  .membersSize = 1,
12381  .members = ExpandedNodeId_members },
12382 
12383 /* StatusCode */
12384 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 19},
12385  .typeIndex = UA_TYPES_STATUSCODE,
12386 #ifdef UA_ENABLE_TYPENAMES
12387  .typeName = "StatusCode",
12388 #endif
12389  .memSize = sizeof(UA_StatusCode),
12390  .builtin = true,
12391  .fixedSize = true,
12392  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12393  .binaryEncodingId = 0,
12394  .membersSize = 1,
12395  .members = StatusCode_members },
12396 
12397 /* QualifiedName */
12398 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 20},
12399  .typeIndex = UA_TYPES_QUALIFIEDNAME,
12400 #ifdef UA_ENABLE_TYPENAMES
12401  .typeName = "QualifiedName",
12402 #endif
12403  .memSize = sizeof(UA_QualifiedName),
12404  .builtin = true,
12405  .fixedSize = false,
12406  .overlayable = false,
12407  .binaryEncodingId = 0,
12408  .membersSize = 2,
12409  .members = QualifiedName_members },
12410 
12411 /* LocalizedText */
12412 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 21},
12413  .typeIndex = UA_TYPES_LOCALIZEDTEXT,
12414 #ifdef UA_ENABLE_TYPENAMES
12415  .typeName = "LocalizedText",
12416 #endif
12417  .memSize = sizeof(UA_LocalizedText),
12418  .builtin = true,
12419  .fixedSize = false,
12420  .overlayable = false,
12421  .binaryEncodingId = 0,
12422  .membersSize = 1,
12423  .members = LocalizedText_members },
12424 
12425 /* ExtensionObject */
12426 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 22},
12427  .typeIndex = UA_TYPES_EXTENSIONOBJECT,
12428 #ifdef UA_ENABLE_TYPENAMES
12429  .typeName = "ExtensionObject",
12430 #endif
12431  .memSize = sizeof(UA_ExtensionObject),
12432  .builtin = true,
12433  .fixedSize = false,
12434  .overlayable = false,
12435  .binaryEncodingId = 0,
12436  .membersSize = 1,
12437  .members = ExtensionObject_members },
12438 
12439 /* DataValue */
12440 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 23},
12441  .typeIndex = UA_TYPES_DATAVALUE,
12442 #ifdef UA_ENABLE_TYPENAMES
12443  .typeName = "DataValue",
12444 #endif
12445  .memSize = sizeof(UA_DataValue),
12446  .builtin = true,
12447  .fixedSize = false,
12448  .overlayable = false,
12449  .binaryEncodingId = 0,
12450  .membersSize = 1,
12451  .members = DataValue_members },
12452 
12453 /* Variant */
12454 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 24},
12455  .typeIndex = UA_TYPES_VARIANT,
12456 #ifdef UA_ENABLE_TYPENAMES
12457  .typeName = "Variant",
12458 #endif
12459  .memSize = sizeof(UA_Variant),
12460  .builtin = true,
12461  .fixedSize = false,
12462  .overlayable = false,
12463  .binaryEncodingId = 0,
12464  .membersSize = 1,
12465  .members = Variant_members },
12466 
12467 /* DiagnosticInfo */
12468 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 25},
12469  .typeIndex = UA_TYPES_DIAGNOSTICINFO,
12470 #ifdef UA_ENABLE_TYPENAMES
12471  .typeName = "DiagnosticInfo",
12472 #endif
12473  .memSize = sizeof(UA_DiagnosticInfo),
12474  .builtin = true,
12475  .fixedSize = false,
12476  .overlayable = false,
12477  .binaryEncodingId = 0,
12478  .membersSize = 1,
12479  .members = DiagnosticInfo_members },
12480 
12481 /* SignedSoftwareCertificate */
12482 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 344},
12484 #ifdef UA_ENABLE_TYPENAMES
12485  .typeName = "SignedSoftwareCertificate",
12486 #endif
12487  .memSize = sizeof(UA_SignedSoftwareCertificate),
12488  .builtin = false,
12489  .fixedSize = false,
12490  .overlayable = false,
12491  .binaryEncodingId = 346,
12492  .membersSize = 2,
12493  .members = SignedSoftwareCertificate_members },
12494 
12495 /* BrowsePathTarget */
12496 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 546},
12497  .typeIndex = UA_TYPES_BROWSEPATHTARGET,
12498 #ifdef UA_ENABLE_TYPENAMES
12499  .typeName = "BrowsePathTarget",
12500 #endif
12501  .memSize = sizeof(UA_BrowsePathTarget),
12502  .builtin = false,
12503  .fixedSize = false,
12504  .overlayable = false,
12505  .binaryEncodingId = 548,
12506  .membersSize = 2,
12507  .members = BrowsePathTarget_members },
12508 
12509 /* ViewAttributes */
12510 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 373},
12511  .typeIndex = UA_TYPES_VIEWATTRIBUTES,
12512 #ifdef UA_ENABLE_TYPENAMES
12513  .typeName = "ViewAttributes",
12514 #endif
12515  .memSize = sizeof(UA_ViewAttributes),
12516  .builtin = false,
12517  .fixedSize = false,
12518  .overlayable = false,
12519  .binaryEncodingId = 375,
12520  .membersSize = 7,
12521  .members = ViewAttributes_members },
12522 
12523 /* BrowseResultMask */
12524 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12525  .typeIndex = UA_TYPES_INT32,
12526 #ifdef UA_ENABLE_TYPENAMES
12527  .typeName = "BrowseResultMask",
12528 #endif
12529  .memSize = sizeof(UA_BrowseResultMask),
12530  .builtin = true,
12531  .fixedSize = true,
12532  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12533  .binaryEncodingId = 0,
12534  .membersSize = 1,
12535  .members = BrowseResultMask_members },
12536 
12537 /* RequestHeader */
12538 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 389},
12539  .typeIndex = UA_TYPES_REQUESTHEADER,
12540 #ifdef UA_ENABLE_TYPENAMES
12541  .typeName = "RequestHeader",
12542 #endif
12543  .memSize = sizeof(UA_RequestHeader),
12544  .builtin = false,
12545  .fixedSize = false,
12546  .overlayable = false,
12547  .binaryEncodingId = 391,
12548  .membersSize = 7,
12549  .members = RequestHeader_members },
12550 
12551 /* MonitoredItemModifyResult */
12552 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 758},
12554 #ifdef UA_ENABLE_TYPENAMES
12555  .typeName = "MonitoredItemModifyResult",
12556 #endif
12557  .memSize = sizeof(UA_MonitoredItemModifyResult),
12558  .builtin = false,
12559  .fixedSize = false,
12560  .overlayable = false,
12561  .binaryEncodingId = 760,
12562  .membersSize = 4,
12563  .members = MonitoredItemModifyResult_members },
12564 
12565 /* CloseSecureChannelRequest */
12566 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 450},
12568 #ifdef UA_ENABLE_TYPENAMES
12569  .typeName = "CloseSecureChannelRequest",
12570 #endif
12571  .memSize = sizeof(UA_CloseSecureChannelRequest),
12572  .builtin = false,
12573  .fixedSize = false,
12574  .overlayable = false,
12575  .binaryEncodingId = 452,
12576  .membersSize = 1,
12577  .members = CloseSecureChannelRequest_members },
12578 
12579 /* AddNodesResult */
12580 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 483},
12581  .typeIndex = UA_TYPES_ADDNODESRESULT,
12582 #ifdef UA_ENABLE_TYPENAMES
12583  .typeName = "AddNodesResult",
12584 #endif
12585  .memSize = sizeof(UA_AddNodesResult),
12586  .builtin = false,
12587  .fixedSize = false,
12588  .overlayable = false,
12589  .binaryEncodingId = 485,
12590  .membersSize = 2,
12591  .members = AddNodesResult_members },
12592 
12593 /* VariableAttributes */
12594 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 355},
12595  .typeIndex = UA_TYPES_VARIABLEATTRIBUTES,
12596 #ifdef UA_ENABLE_TYPENAMES
12597  .typeName = "VariableAttributes",
12598 #endif
12599  .memSize = sizeof(UA_VariableAttributes),
12600  .builtin = false,
12601  .fixedSize = false,
12602  .overlayable = false,
12603  .binaryEncodingId = 357,
12604  .membersSize = 13,
12605  .members = VariableAttributes_members },
12606 
12607 /* NotificationMessage */
12608 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 803},
12609  .typeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
12610 #ifdef UA_ENABLE_TYPENAMES
12611  .typeName = "NotificationMessage",
12612 #endif
12613  .memSize = sizeof(UA_NotificationMessage),
12614  .builtin = false,
12615  .fixedSize = false,
12616  .overlayable = false,
12617  .binaryEncodingId = 805,
12618  .membersSize = 3,
12619  .members = NotificationMessage_members },
12620 
12621 /* NodeAttributesMask */
12622 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12623  .typeIndex = UA_TYPES_INT32,
12624 #ifdef UA_ENABLE_TYPENAMES
12625  .typeName = "NodeAttributesMask",
12626 #endif
12627  .memSize = sizeof(UA_NodeAttributesMask),
12628  .builtin = true,
12629  .fixedSize = true,
12630  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12631  .binaryEncodingId = 0,
12632  .membersSize = 1,
12633  .members = NodeAttributesMask_members },
12634 
12635 /* MonitoringMode */
12636 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12637  .typeIndex = UA_TYPES_INT32,
12638 #ifdef UA_ENABLE_TYPENAMES
12639  .typeName = "MonitoringMode",
12640 #endif
12641  .memSize = sizeof(UA_MonitoringMode),
12642  .builtin = true,
12643  .fixedSize = true,
12644  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12645  .binaryEncodingId = 0,
12646  .membersSize = 1,
12647  .members = MonitoringMode_members },
12648 
12649 /* CallMethodResult */
12650 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 707},
12651  .typeIndex = UA_TYPES_CALLMETHODRESULT,
12652 #ifdef UA_ENABLE_TYPENAMES
12653  .typeName = "CallMethodResult",
12654 #endif
12655  .memSize = sizeof(UA_CallMethodResult),
12656  .builtin = false,
12657  .fixedSize = false,
12658  .overlayable = false,
12659  .binaryEncodingId = 709,
12660  .membersSize = 4,
12661  .members = CallMethodResult_members },
12662 
12663 /* ParsingResult */
12664 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 610},
12665  .typeIndex = UA_TYPES_PARSINGRESULT,
12666 #ifdef UA_ENABLE_TYPENAMES
12667  .typeName = "ParsingResult",
12668 #endif
12669  .memSize = sizeof(UA_ParsingResult),
12670  .builtin = false,
12671  .fixedSize = false,
12672  .overlayable = false,
12673  .binaryEncodingId = 612,
12674  .membersSize = 3,
12675  .members = ParsingResult_members },
12676 
12677 /* RelativePathElement */
12678 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 537},
12679  .typeIndex = UA_TYPES_RELATIVEPATHELEMENT,
12680 #ifdef UA_ENABLE_TYPENAMES
12681  .typeName = "RelativePathElement",
12682 #endif
12683  .memSize = sizeof(UA_RelativePathElement),
12684  .builtin = false,
12685  .fixedSize = false,
12686  .overlayable = false,
12687  .binaryEncodingId = 539,
12688  .membersSize = 4,
12689  .members = RelativePathElement_members },
12690 
12691 /* BrowseDirection */
12692 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12693  .typeIndex = UA_TYPES_INT32,
12694 #ifdef UA_ENABLE_TYPENAMES
12695  .typeName = "BrowseDirection",
12696 #endif
12697  .memSize = sizeof(UA_BrowseDirection),
12698  .builtin = true,
12699  .fixedSize = true,
12700  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12701  .binaryEncodingId = 0,
12702  .membersSize = 1,
12703  .members = BrowseDirection_members },
12704 
12705 /* CallMethodRequest */
12706 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 704},
12707  .typeIndex = UA_TYPES_CALLMETHODREQUEST,
12708 #ifdef UA_ENABLE_TYPENAMES
12709  .typeName = "CallMethodRequest",
12710 #endif
12711  .memSize = sizeof(UA_CallMethodRequest),
12712  .builtin = false,
12713  .fixedSize = false,
12714  .overlayable = false,
12715  .binaryEncodingId = 706,
12716  .membersSize = 3,
12717  .members = CallMethodRequest_members },
12718 
12719 /* UnregisterNodesRequest */
12720 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 564},
12721  .typeIndex = UA_TYPES_UNREGISTERNODESREQUEST,
12722 #ifdef UA_ENABLE_TYPENAMES
12723  .typeName = "UnregisterNodesRequest",
12724 #endif
12725  .memSize = sizeof(UA_UnregisterNodesRequest),
12726  .builtin = false,
12727  .fixedSize = false,
12728  .overlayable = false,
12729  .binaryEncodingId = 566,
12730  .membersSize = 2,
12731  .members = UnregisterNodesRequest_members },
12732 
12733 /* ContentFilterElementResult */
12734 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 604},
12736 #ifdef UA_ENABLE_TYPENAMES
12737  .typeName = "ContentFilterElementResult",
12738 #endif
12739  .memSize = sizeof(UA_ContentFilterElementResult),
12740  .builtin = false,
12741  .fixedSize = false,
12742  .overlayable = false,
12743  .binaryEncodingId = 606,
12744  .membersSize = 3,
12745  .members = ContentFilterElementResult_members },
12746 
12747 /* QueryDataSet */
12748 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 577},
12749  .typeIndex = UA_TYPES_QUERYDATASET,
12750 #ifdef UA_ENABLE_TYPENAMES
12751  .typeName = "QueryDataSet",
12752 #endif
12753  .memSize = sizeof(UA_QueryDataSet),
12754  .builtin = false,
12755  .fixedSize = false,
12756  .overlayable = false,
12757  .binaryEncodingId = 579,
12758  .membersSize = 3,
12759  .members = QueryDataSet_members },
12760 
12761 /* AnonymousIdentityToken */
12762 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 319},
12763  .typeIndex = UA_TYPES_ANONYMOUSIDENTITYTOKEN,
12764 #ifdef UA_ENABLE_TYPENAMES
12765  .typeName = "AnonymousIdentityToken",
12766 #endif
12767  .memSize = sizeof(UA_AnonymousIdentityToken),
12768  .builtin = false,
12769  .fixedSize = false,
12770  .overlayable = false,
12771  .binaryEncodingId = 321,
12772  .membersSize = 1,
12773  .members = AnonymousIdentityToken_members },
12774 
12775 /* SetPublishingModeRequest */
12776 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 797},
12777  .typeIndex = UA_TYPES_SETPUBLISHINGMODEREQUEST,
12778 #ifdef UA_ENABLE_TYPENAMES
12779  .typeName = "SetPublishingModeRequest",
12780 #endif
12781  .memSize = sizeof(UA_SetPublishingModeRequest),
12782  .builtin = false,
12783  .fixedSize = false,
12784  .overlayable = false,
12785  .binaryEncodingId = 799,
12786  .membersSize = 3,
12787  .members = SetPublishingModeRequest_members },
12788 
12789 /* TimestampsToReturn */
12790 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12791  .typeIndex = UA_TYPES_INT32,
12792 #ifdef UA_ENABLE_TYPENAMES
12793  .typeName = "TimestampsToReturn",
12794 #endif
12795  .memSize = sizeof(UA_TimestampsToReturn),
12796  .builtin = true,
12797  .fixedSize = true,
12798  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12799  .binaryEncodingId = 0,
12800  .membersSize = 1,
12801  .members = TimestampsToReturn_members },
12802 
12803 /* CallRequest */
12804 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 710},
12805  .typeIndex = UA_TYPES_CALLREQUEST,
12806 #ifdef UA_ENABLE_TYPENAMES
12807  .typeName = "CallRequest",
12808 #endif
12809  .memSize = sizeof(UA_CallRequest),
12810  .builtin = false,
12811  .fixedSize = false,
12812  .overlayable = false,
12813  .binaryEncodingId = 712,
12814  .membersSize = 2,
12815  .members = CallRequest_members },
12816 
12817 /* MethodAttributes */
12818 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 358},
12819  .typeIndex = UA_TYPES_METHODATTRIBUTES,
12820 #ifdef UA_ENABLE_TYPENAMES
12821  .typeName = "MethodAttributes",
12822 #endif
12823  .memSize = sizeof(UA_MethodAttributes),
12824  .builtin = false,
12825  .fixedSize = false,
12826  .overlayable = false,
12827  .binaryEncodingId = 360,
12828  .membersSize = 7,
12829  .members = MethodAttributes_members },
12830 
12831 /* DeleteReferencesItem */
12832 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 385},
12833  .typeIndex = UA_TYPES_DELETEREFERENCESITEM,
12834 #ifdef UA_ENABLE_TYPENAMES
12835  .typeName = "DeleteReferencesItem",
12836 #endif
12837  .memSize = sizeof(UA_DeleteReferencesItem),
12838  .builtin = false,
12839  .fixedSize = false,
12840  .overlayable = false,
12841  .binaryEncodingId = 387,
12842  .membersSize = 5,
12843  .members = DeleteReferencesItem_members },
12844 
12845 /* WriteValue */
12846 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 668},
12847  .typeIndex = UA_TYPES_WRITEVALUE,
12848 #ifdef UA_ENABLE_TYPENAMES
12849  .typeName = "WriteValue",
12850 #endif
12851  .memSize = sizeof(UA_WriteValue),
12852  .builtin = false,
12853  .fixedSize = false,
12854  .overlayable = false,
12855  .binaryEncodingId = 670,
12856  .membersSize = 4,
12857  .members = WriteValue_members },
12858 
12859 /* MonitoredItemCreateResult */
12860 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 746},
12862 #ifdef UA_ENABLE_TYPENAMES
12863  .typeName = "MonitoredItemCreateResult",
12864 #endif
12865  .memSize = sizeof(UA_MonitoredItemCreateResult),
12866  .builtin = false,
12867  .fixedSize = false,
12868  .overlayable = false,
12869  .binaryEncodingId = 748,
12870  .membersSize = 5,
12871  .members = MonitoredItemCreateResult_members },
12872 
12873 /* MessageSecurityMode */
12874 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12875  .typeIndex = UA_TYPES_INT32,
12876 #ifdef UA_ENABLE_TYPENAMES
12877  .typeName = "MessageSecurityMode",
12878 #endif
12879  .memSize = sizeof(UA_MessageSecurityMode),
12880  .builtin = true,
12881  .fixedSize = true,
12882  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12883  .binaryEncodingId = 0,
12884  .membersSize = 1,
12885  .members = MessageSecurityMode_members },
12886 
12887 /* MonitoringParameters */
12888 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 740},
12889  .typeIndex = UA_TYPES_MONITORINGPARAMETERS,
12890 #ifdef UA_ENABLE_TYPENAMES
12891  .typeName = "MonitoringParameters",
12892 #endif
12893  .memSize = sizeof(UA_MonitoringParameters),
12894  .builtin = false,
12895  .fixedSize = false,
12896  .overlayable = false,
12897  .binaryEncodingId = 742,
12898  .membersSize = 5,
12899  .members = MonitoringParameters_members },
12900 
12901 /* SignatureData */
12902 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 456},
12903  .typeIndex = UA_TYPES_SIGNATUREDATA,
12904 #ifdef UA_ENABLE_TYPENAMES
12905  .typeName = "SignatureData",
12906 #endif
12907  .memSize = sizeof(UA_SignatureData),
12908  .builtin = false,
12909  .fixedSize = false,
12910  .overlayable = false,
12911  .binaryEncodingId = 458,
12912  .membersSize = 2,
12913  .members = SignatureData_members },
12914 
12915 /* ReferenceNode */
12916 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 285},
12917  .typeIndex = UA_TYPES_REFERENCENODE,
12918 #ifdef UA_ENABLE_TYPENAMES
12919  .typeName = "ReferenceNode",
12920 #endif
12921  .memSize = sizeof(UA_ReferenceNode),
12922  .builtin = false,
12923  .fixedSize = false,
12924  .overlayable = false,
12925  .binaryEncodingId = 287,
12926  .membersSize = 3,
12927  .members = ReferenceNode_members },
12928 
12929 /* Argument */
12930 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 296},
12931  .typeIndex = UA_TYPES_ARGUMENT,
12932 #ifdef UA_ENABLE_TYPENAMES
12933  .typeName = "Argument",
12934 #endif
12935  .memSize = sizeof(UA_Argument),
12936  .builtin = false,
12937  .fixedSize = false,
12938  .overlayable = false,
12939  .binaryEncodingId = 298,
12940  .membersSize = 5,
12941  .members = Argument_members },
12942 
12943 /* UserIdentityToken */
12944 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 316},
12945  .typeIndex = UA_TYPES_USERIDENTITYTOKEN,
12946 #ifdef UA_ENABLE_TYPENAMES
12947  .typeName = "UserIdentityToken",
12948 #endif
12949  .memSize = sizeof(UA_UserIdentityToken),
12950  .builtin = false,
12951  .fixedSize = false,
12952  .overlayable = false,
12953  .binaryEncodingId = 318,
12954  .membersSize = 1,
12955  .members = UserIdentityToken_members },
12956 
12957 /* ObjectTypeAttributes */
12958 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 361},
12959  .typeIndex = UA_TYPES_OBJECTTYPEATTRIBUTES,
12960 #ifdef UA_ENABLE_TYPENAMES
12961  .typeName = "ObjectTypeAttributes",
12962 #endif
12963  .memSize = sizeof(UA_ObjectTypeAttributes),
12964  .builtin = false,
12965  .fixedSize = false,
12966  .overlayable = false,
12967  .binaryEncodingId = 363,
12968  .membersSize = 6,
12969  .members = ObjectTypeAttributes_members },
12970 
12971 /* DeadbandType */
12972 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12973  .typeIndex = UA_TYPES_INT32,
12974 #ifdef UA_ENABLE_TYPENAMES
12975  .typeName = "DeadbandType",
12976 #endif
12977  .memSize = sizeof(UA_DeadbandType),
12978  .builtin = true,
12979  .fixedSize = true,
12980  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12981  .binaryEncodingId = 0,
12982  .membersSize = 1,
12983  .members = DeadbandType_members },
12984 
12985 /* SecurityTokenRequestType */
12986 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12987  .typeIndex = UA_TYPES_INT32,
12988 #ifdef UA_ENABLE_TYPENAMES
12989  .typeName = "SecurityTokenRequestType",
12990 #endif
12991  .memSize = sizeof(UA_SecurityTokenRequestType),
12992  .builtin = true,
12993  .fixedSize = true,
12994  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12995  .binaryEncodingId = 0,
12996  .membersSize = 1,
12997  .members = SecurityTokenRequestType_members },
12998 
12999 /* DataChangeTrigger */
13000 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13001  .typeIndex = UA_TYPES_INT32,
13002 #ifdef UA_ENABLE_TYPENAMES
13003  .typeName = "DataChangeTrigger",
13004 #endif
13005  .memSize = sizeof(UA_DataChangeTrigger),
13006  .builtin = true,
13007  .fixedSize = true,
13008  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13009  .binaryEncodingId = 0,
13010  .membersSize = 1,
13011  .members = DataChangeTrigger_members },
13012 
13013 /* BuildInfo */
13014 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 338},
13015  .typeIndex = UA_TYPES_BUILDINFO,
13016 #ifdef UA_ENABLE_TYPENAMES
13017  .typeName = "BuildInfo",
13018 #endif
13019  .memSize = sizeof(UA_BuildInfo),
13020  .builtin = false,
13021  .fixedSize = false,
13022  .overlayable = false,
13023  .binaryEncodingId = 340,
13024  .membersSize = 6,
13025  .members = BuildInfo_members },
13026 
13027 /* NodeClass */
13028 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13029  .typeIndex = UA_TYPES_INT32,
13030 #ifdef UA_ENABLE_TYPENAMES
13031  .typeName = "NodeClass",
13032 #endif
13033  .memSize = sizeof(UA_NodeClass),
13034  .builtin = true,
13035  .fixedSize = true,
13036  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13037  .binaryEncodingId = 0,
13038  .membersSize = 1,
13039  .members = NodeClass_members },
13040 
13041 /* ChannelSecurityToken */
13042 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 441},
13043  .typeIndex = UA_TYPES_CHANNELSECURITYTOKEN,
13044 #ifdef UA_ENABLE_TYPENAMES
13045  .typeName = "ChannelSecurityToken",
13046 #endif
13047  .memSize = sizeof(UA_ChannelSecurityToken),
13048  .builtin = false,
13049  .fixedSize = true,
13050  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, tokenId) == (offsetof(UA_ChannelSecurityToken, channelId) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, createdAt) == (offsetof(UA_ChannelSecurityToken, tokenId) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, revisedLifetime) == (offsetof(UA_ChannelSecurityToken, createdAt) + sizeof(UA_DateTime)),
13051  .binaryEncodingId = 443,
13052  .membersSize = 4,
13053  .members = ChannelSecurityToken_members },
13054 
13055 /* MonitoredItemNotification */
13056 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 806},
13058 #ifdef UA_ENABLE_TYPENAMES
13059  .typeName = "MonitoredItemNotification",
13060 #endif
13061  .memSize = sizeof(UA_MonitoredItemNotification),
13062  .builtin = false,
13063  .fixedSize = false,
13064  .overlayable = false,
13065  .binaryEncodingId = 808,
13066  .membersSize = 2,
13067  .members = MonitoredItemNotification_members },
13068 
13069 /* DeleteNodesItem */
13070 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 382},
13071  .typeIndex = UA_TYPES_DELETENODESITEM,
13072 #ifdef UA_ENABLE_TYPENAMES
13073  .typeName = "DeleteNodesItem",
13074 #endif
13075  .memSize = sizeof(UA_DeleteNodesItem),
13076  .builtin = false,
13077  .fixedSize = false,
13078  .overlayable = false,
13079  .binaryEncodingId = 384,
13080  .membersSize = 2,
13081  .members = DeleteNodesItem_members },
13082 
13083 /* SubscriptionAcknowledgement */
13084 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 821},
13086 #ifdef UA_ENABLE_TYPENAMES
13087  .typeName = "SubscriptionAcknowledgement",
13088 #endif
13089  .memSize = sizeof(UA_SubscriptionAcknowledgement),
13090  .builtin = false,
13091  .fixedSize = true,
13092  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) == (offsetof(UA_SubscriptionAcknowledgement, subscriptionId) + sizeof(UA_UInt32)),
13093  .binaryEncodingId = 823,
13094  .membersSize = 2,
13095  .members = SubscriptionAcknowledgement_members },
13096 
13097 /* ReadValueId */
13098 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 626},
13099  .typeIndex = UA_TYPES_READVALUEID,
13100 #ifdef UA_ENABLE_TYPENAMES
13101  .typeName = "ReadValueId",
13102 #endif
13103  .memSize = sizeof(UA_ReadValueId),
13104  .builtin = false,
13105  .fixedSize = false,
13106  .overlayable = false,
13107  .binaryEncodingId = 628,
13108  .membersSize = 4,
13109  .members = ReadValueId_members },
13110 
13111 /* DataTypeAttributes */
13112 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 370},
13113  .typeIndex = UA_TYPES_DATATYPEATTRIBUTES,
13114 #ifdef UA_ENABLE_TYPENAMES
13115  .typeName = "DataTypeAttributes",
13116 #endif
13117  .memSize = sizeof(UA_DataTypeAttributes),
13118  .builtin = false,
13119  .fixedSize = false,
13120  .overlayable = false,
13121  .binaryEncodingId = 372,
13122  .membersSize = 6,
13123  .members = DataTypeAttributes_members },
13124 
13125 /* ResponseHeader */
13126 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 392},
13127  .typeIndex = UA_TYPES_RESPONSEHEADER,
13128 #ifdef UA_ENABLE_TYPENAMES
13129  .typeName = "ResponseHeader",
13130 #endif
13131  .memSize = sizeof(UA_ResponseHeader),
13132  .builtin = false,
13133  .fixedSize = false,
13134  .overlayable = false,
13135  .binaryEncodingId = 394,
13136  .membersSize = 6,
13137  .members = ResponseHeader_members },
13138 
13139 /* DeleteSubscriptionsRequest */
13140 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 845},
13142 #ifdef UA_ENABLE_TYPENAMES
13143  .typeName = "DeleteSubscriptionsRequest",
13144 #endif
13145  .memSize = sizeof(UA_DeleteSubscriptionsRequest),
13146  .builtin = false,
13147  .fixedSize = false,
13148  .overlayable = false,
13149  .binaryEncodingId = 847,
13150  .membersSize = 2,
13151  .members = DeleteSubscriptionsRequest_members },
13152 
13153 /* ViewDescription */
13154 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 511},
13155  .typeIndex = UA_TYPES_VIEWDESCRIPTION,
13156 #ifdef UA_ENABLE_TYPENAMES
13157  .typeName = "ViewDescription",
13158 #endif
13159  .memSize = sizeof(UA_ViewDescription),
13160  .builtin = false,
13161  .fixedSize = false,
13162  .overlayable = false,
13163  .binaryEncodingId = 513,
13164  .membersSize = 3,
13165  .members = ViewDescription_members },
13166 
13167 /* DeleteMonitoredItemsResponse */
13168 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 782},
13170 #ifdef UA_ENABLE_TYPENAMES
13171  .typeName = "DeleteMonitoredItemsResponse",
13172 #endif
13173  .memSize = sizeof(UA_DeleteMonitoredItemsResponse),
13174  .builtin = false,
13175  .fixedSize = false,
13176  .overlayable = false,
13177  .binaryEncodingId = 784,
13178  .membersSize = 3,
13179  .members = DeleteMonitoredItemsResponse_members },
13180 
13181 /* NodeAttributes */
13182 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 349},
13183  .typeIndex = UA_TYPES_NODEATTRIBUTES,
13184 #ifdef UA_ENABLE_TYPENAMES
13185  .typeName = "NodeAttributes",
13186 #endif
13187  .memSize = sizeof(UA_NodeAttributes),
13188  .builtin = false,
13189  .fixedSize = false,
13190  .overlayable = false,
13191  .binaryEncodingId = 351,
13192  .membersSize = 5,
13193  .members = NodeAttributes_members },
13194 
13195 /* RegisterNodesRequest */
13196 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 558},
13197  .typeIndex = UA_TYPES_REGISTERNODESREQUEST,
13198 #ifdef UA_ENABLE_TYPENAMES
13199  .typeName = "RegisterNodesRequest",
13200 #endif
13201  .memSize = sizeof(UA_RegisterNodesRequest),
13202  .builtin = false,
13203  .fixedSize = false,
13204  .overlayable = false,
13205  .binaryEncodingId = 560,
13206  .membersSize = 2,
13207  .members = RegisterNodesRequest_members },
13208 
13209 /* DeleteNodesRequest */
13210 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 498},
13211  .typeIndex = UA_TYPES_DELETENODESREQUEST,
13212 #ifdef UA_ENABLE_TYPENAMES
13213  .typeName = "DeleteNodesRequest",
13214 #endif
13215  .memSize = sizeof(UA_DeleteNodesRequest),
13216  .builtin = false,
13217  .fixedSize = false,
13218  .overlayable = false,
13219  .binaryEncodingId = 500,
13220  .membersSize = 2,
13221  .members = DeleteNodesRequest_members },
13222 
13223 /* PublishResponse */
13224 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 827},
13225  .typeIndex = UA_TYPES_PUBLISHRESPONSE,
13226 #ifdef UA_ENABLE_TYPENAMES
13227  .typeName = "PublishResponse",
13228 #endif
13229  .memSize = sizeof(UA_PublishResponse),
13230  .builtin = false,
13231  .fixedSize = false,
13232  .overlayable = false,
13233  .binaryEncodingId = 829,
13234  .membersSize = 7,
13235  .members = PublishResponse_members },
13236 
13237 /* MonitoredItemModifyRequest */
13238 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 755},
13240 #ifdef UA_ENABLE_TYPENAMES
13241  .typeName = "MonitoredItemModifyRequest",
13242 #endif
13243  .memSize = sizeof(UA_MonitoredItemModifyRequest),
13244  .builtin = false,
13245  .fixedSize = false,
13246  .overlayable = false,
13247  .binaryEncodingId = 757,
13248  .membersSize = 2,
13249  .members = MonitoredItemModifyRequest_members },
13250 
13251 /* UserNameIdentityToken */
13252 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 322},
13253  .typeIndex = UA_TYPES_USERNAMEIDENTITYTOKEN,
13254 #ifdef UA_ENABLE_TYPENAMES
13255  .typeName = "UserNameIdentityToken",
13256 #endif
13257  .memSize = sizeof(UA_UserNameIdentityToken),
13258  .builtin = false,
13259  .fixedSize = false,
13260  .overlayable = false,
13261  .binaryEncodingId = 324,
13262  .membersSize = 4,
13263  .members = UserNameIdentityToken_members },
13264 
13265 /* IdType */
13266 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13267  .typeIndex = UA_TYPES_INT32,
13268 #ifdef UA_ENABLE_TYPENAMES
13269  .typeName = "IdType",
13270 #endif
13271  .memSize = sizeof(UA_IdType),
13272  .builtin = true,
13273  .fixedSize = true,
13274  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13275  .binaryEncodingId = 0,
13276  .membersSize = 1,
13277  .members = IdType_members },
13278 
13279 /* UserTokenType */
13280 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13281  .typeIndex = UA_TYPES_INT32,
13282 #ifdef UA_ENABLE_TYPENAMES
13283  .typeName = "UserTokenType",
13284 #endif
13285  .memSize = sizeof(UA_UserTokenType),
13286  .builtin = true,
13287  .fixedSize = true,
13288  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13289  .binaryEncodingId = 0,
13290  .membersSize = 1,
13291  .members = UserTokenType_members },
13292 
13293 /* ActivateSessionRequest */
13294 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 465},
13295  .typeIndex = UA_TYPES_ACTIVATESESSIONREQUEST,
13296 #ifdef UA_ENABLE_TYPENAMES
13297  .typeName = "ActivateSessionRequest",
13298 #endif
13299  .memSize = sizeof(UA_ActivateSessionRequest),
13300  .builtin = false,
13301  .fixedSize = false,
13302  .overlayable = false,
13303  .binaryEncodingId = 467,
13304  .membersSize = 6,
13305  .members = ActivateSessionRequest_members },
13306 
13307 /* OpenSecureChannelResponse */
13308 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 447},
13310 #ifdef UA_ENABLE_TYPENAMES
13311  .typeName = "OpenSecureChannelResponse",
13312 #endif
13313  .memSize = sizeof(UA_OpenSecureChannelResponse),
13314  .builtin = false,
13315  .fixedSize = false,
13316  .overlayable = false,
13317  .binaryEncodingId = 449,
13318  .membersSize = 4,
13319  .members = OpenSecureChannelResponse_members },
13320 
13321 /* ApplicationType */
13322 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13323  .typeIndex = UA_TYPES_INT32,
13324 #ifdef UA_ENABLE_TYPENAMES
13325  .typeName = "ApplicationType",
13326 #endif
13327  .memSize = sizeof(UA_ApplicationType),
13328  .builtin = true,
13329  .fixedSize = true,
13330  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13331  .binaryEncodingId = 0,
13332  .membersSize = 1,
13333  .members = ApplicationType_members },
13334 
13335 /* ServerState */
13336 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13337  .typeIndex = UA_TYPES_INT32,
13338 #ifdef UA_ENABLE_TYPENAMES
13339  .typeName = "ServerState",
13340 #endif
13341  .memSize = sizeof(UA_ServerState),
13342  .builtin = true,
13343  .fixedSize = true,
13344  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13345  .binaryEncodingId = 0,
13346  .membersSize = 1,
13347  .members = ServerState_members },
13348 
13349 /* QueryNextResponse */
13350 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 622},
13351  .typeIndex = UA_TYPES_QUERYNEXTRESPONSE,
13352 #ifdef UA_ENABLE_TYPENAMES
13353  .typeName = "QueryNextResponse",
13354 #endif
13355  .memSize = sizeof(UA_QueryNextResponse),
13356  .builtin = false,
13357  .fixedSize = false,
13358  .overlayable = false,
13359  .binaryEncodingId = 624,
13360  .membersSize = 3,
13361  .members = QueryNextResponse_members },
13362 
13363 /* ActivateSessionResponse */
13364 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 468},
13365  .typeIndex = UA_TYPES_ACTIVATESESSIONRESPONSE,
13366 #ifdef UA_ENABLE_TYPENAMES
13367  .typeName = "ActivateSessionResponse",
13368 #endif
13369  .memSize = sizeof(UA_ActivateSessionResponse),
13370  .builtin = false,
13371  .fixedSize = false,
13372  .overlayable = false,
13373  .binaryEncodingId = 470,
13374  .membersSize = 4,
13375  .members = ActivateSessionResponse_members },
13376 
13377 /* FilterOperator */
13378 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13379  .typeIndex = UA_TYPES_INT32,
13380 #ifdef UA_ENABLE_TYPENAMES
13381  .typeName = "FilterOperator",
13382 #endif
13383  .memSize = sizeof(UA_FilterOperator),
13384  .builtin = true,
13385  .fixedSize = true,
13386  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13387  .binaryEncodingId = 0,
13388  .membersSize = 1,
13389  .members = FilterOperator_members },
13390 
13391 /* QueryNextRequest */
13392 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 619},
13393  .typeIndex = UA_TYPES_QUERYNEXTREQUEST,
13394 #ifdef UA_ENABLE_TYPENAMES
13395  .typeName = "QueryNextRequest",
13396 #endif
13397  .memSize = sizeof(UA_QueryNextRequest),
13398  .builtin = false,
13399  .fixedSize = false,
13400  .overlayable = false,
13401  .binaryEncodingId = 621,
13402  .membersSize = 3,
13403  .members = QueryNextRequest_members },
13404 
13405 /* WriteResponse */
13406 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 674},
13407  .typeIndex = UA_TYPES_WRITERESPONSE,
13408 #ifdef UA_ENABLE_TYPENAMES
13409  .typeName = "WriteResponse",
13410 #endif
13411  .memSize = sizeof(UA_WriteResponse),
13412  .builtin = false,
13413  .fixedSize = false,
13414  .overlayable = false,
13415  .binaryEncodingId = 676,
13416  .membersSize = 3,
13417  .members = WriteResponse_members },
13418 
13419 /* BrowseNextRequest */
13420 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 531},
13421  .typeIndex = UA_TYPES_BROWSENEXTREQUEST,
13422 #ifdef UA_ENABLE_TYPENAMES
13423  .typeName = "BrowseNextRequest",
13424 #endif
13425  .memSize = sizeof(UA_BrowseNextRequest),
13426  .builtin = false,
13427  .fixedSize = false,
13428  .overlayable = false,
13429  .binaryEncodingId = 533,
13430  .membersSize = 3,
13431  .members = BrowseNextRequest_members },
13432 
13433 /* CreateSubscriptionRequest */
13434 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 785},
13436 #ifdef UA_ENABLE_TYPENAMES
13437  .typeName = "CreateSubscriptionRequest",
13438 #endif
13439  .memSize = sizeof(UA_CreateSubscriptionRequest),
13440  .builtin = false,
13441  .fixedSize = false,
13442  .overlayable = false,
13443  .binaryEncodingId = 787,
13444  .membersSize = 7,
13445  .members = CreateSubscriptionRequest_members },
13446 
13447 /* VariableTypeAttributes */
13448 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 364},
13449  .typeIndex = UA_TYPES_VARIABLETYPEATTRIBUTES,
13450 #ifdef UA_ENABLE_TYPENAMES
13451  .typeName = "VariableTypeAttributes",
13452 #endif
13453  .memSize = sizeof(UA_VariableTypeAttributes),
13454  .builtin = false,
13455  .fixedSize = false,
13456  .overlayable = false,
13457  .binaryEncodingId = 366,
13458  .membersSize = 10,
13459  .members = VariableTypeAttributes_members },
13460 
13461 /* BrowsePathResult */
13462 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 549},
13463  .typeIndex = UA_TYPES_BROWSEPATHRESULT,
13464 #ifdef UA_ENABLE_TYPENAMES
13465  .typeName = "BrowsePathResult",
13466 #endif
13467  .memSize = sizeof(UA_BrowsePathResult),
13468  .builtin = false,
13469  .fixedSize = false,
13470  .overlayable = false,
13471  .binaryEncodingId = 551,
13472  .membersSize = 2,
13473  .members = BrowsePathResult_members },
13474 
13475 /* ModifySubscriptionResponse */
13476 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 794},
13478 #ifdef UA_ENABLE_TYPENAMES
13479  .typeName = "ModifySubscriptionResponse",
13480 #endif
13481  .memSize = sizeof(UA_ModifySubscriptionResponse),
13482  .builtin = false,
13483  .fixedSize = false,
13484  .overlayable = false,
13485  .binaryEncodingId = 796,
13486  .membersSize = 4,
13487  .members = ModifySubscriptionResponse_members },
13488 
13489 /* OpenSecureChannelRequest */
13490 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 444},
13491  .typeIndex = UA_TYPES_OPENSECURECHANNELREQUEST,
13492 #ifdef UA_ENABLE_TYPENAMES
13493  .typeName = "OpenSecureChannelRequest",
13494 #endif
13495  .memSize = sizeof(UA_OpenSecureChannelRequest),
13496  .builtin = false,
13497  .fixedSize = false,
13498  .overlayable = false,
13499  .binaryEncodingId = 446,
13500  .membersSize = 6,
13501  .members = OpenSecureChannelRequest_members },
13502 
13503 /* RegisterNodesResponse */
13504 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 561},
13505  .typeIndex = UA_TYPES_REGISTERNODESRESPONSE,
13506 #ifdef UA_ENABLE_TYPENAMES
13507  .typeName = "RegisterNodesResponse",
13508 #endif
13509  .memSize = sizeof(UA_RegisterNodesResponse),
13510  .builtin = false,
13511  .fixedSize = false,
13512  .overlayable = false,
13513  .binaryEncodingId = 563,
13514  .membersSize = 2,
13515  .members = RegisterNodesResponse_members },
13516 
13517 /* CloseSessionRequest */
13518 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 471},
13519  .typeIndex = UA_TYPES_CLOSESESSIONREQUEST,
13520 #ifdef UA_ENABLE_TYPENAMES
13521  .typeName = "CloseSessionRequest",
13522 #endif
13523  .memSize = sizeof(UA_CloseSessionRequest),
13524  .builtin = false,
13525  .fixedSize = false,
13526  .overlayable = false,
13527  .binaryEncodingId = 473,
13528  .membersSize = 2,
13529  .members = CloseSessionRequest_members },
13530 
13531 /* ModifySubscriptionRequest */
13532 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 791},
13534 #ifdef UA_ENABLE_TYPENAMES
13535  .typeName = "ModifySubscriptionRequest",
13536 #endif
13537  .memSize = sizeof(UA_ModifySubscriptionRequest),
13538  .builtin = false,
13539  .fixedSize = false,
13540  .overlayable = false,
13541  .binaryEncodingId = 793,
13542  .membersSize = 7,
13543  .members = ModifySubscriptionRequest_members },
13544 
13545 /* UserTokenPolicy */
13546 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 304},
13547  .typeIndex = UA_TYPES_USERTOKENPOLICY,
13548 #ifdef UA_ENABLE_TYPENAMES
13549  .typeName = "UserTokenPolicy",
13550 #endif
13551  .memSize = sizeof(UA_UserTokenPolicy),
13552  .builtin = false,
13553  .fixedSize = false,
13554  .overlayable = false,
13555  .binaryEncodingId = 306,
13556  .membersSize = 5,
13557  .members = UserTokenPolicy_members },
13558 
13559 /* DeleteMonitoredItemsRequest */
13560 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 779},
13562 #ifdef UA_ENABLE_TYPENAMES
13563  .typeName = "DeleteMonitoredItemsRequest",
13564 #endif
13565  .memSize = sizeof(UA_DeleteMonitoredItemsRequest),
13566  .builtin = false,
13567  .fixedSize = false,
13568  .overlayable = false,
13569  .binaryEncodingId = 781,
13570  .membersSize = 3,
13571  .members = DeleteMonitoredItemsRequest_members },
13572 
13573 /* ReferenceTypeAttributes */
13574 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 367},
13575  .typeIndex = UA_TYPES_REFERENCETYPEATTRIBUTES,
13576 #ifdef UA_ENABLE_TYPENAMES
13577  .typeName = "ReferenceTypeAttributes",
13578 #endif
13579  .memSize = sizeof(UA_ReferenceTypeAttributes),
13580  .builtin = false,
13581  .fixedSize = false,
13582  .overlayable = false,
13583  .binaryEncodingId = 369,
13584  .membersSize = 8,
13585  .members = ReferenceTypeAttributes_members },
13586 
13587 /* SetMonitoringModeRequest */
13588 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 767},
13589  .typeIndex = UA_TYPES_SETMONITORINGMODEREQUEST,
13590 #ifdef UA_ENABLE_TYPENAMES
13591  .typeName = "SetMonitoringModeRequest",
13592 #endif
13593  .memSize = sizeof(UA_SetMonitoringModeRequest),
13594  .builtin = false,
13595  .fixedSize = false,
13596  .overlayable = false,
13597  .binaryEncodingId = 769,
13598  .membersSize = 4,
13599  .members = SetMonitoringModeRequest_members },
13600 
13601 /* UnregisterNodesResponse */
13602 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 567},
13603  .typeIndex = UA_TYPES_UNREGISTERNODESRESPONSE,
13604 #ifdef UA_ENABLE_TYPENAMES
13605  .typeName = "UnregisterNodesResponse",
13606 #endif
13607  .memSize = sizeof(UA_UnregisterNodesResponse),
13608  .builtin = false,
13609  .fixedSize = false,
13610  .overlayable = false,
13611  .binaryEncodingId = 569,
13612  .membersSize = 1,
13613  .members = UnregisterNodesResponse_members },
13614 
13615 /* WriteRequest */
13616 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 671},
13617  .typeIndex = UA_TYPES_WRITEREQUEST,
13618 #ifdef UA_ENABLE_TYPENAMES
13619  .typeName = "WriteRequest",
13620 #endif
13621  .memSize = sizeof(UA_WriteRequest),
13622  .builtin = false,
13623  .fixedSize = false,
13624  .overlayable = false,
13625  .binaryEncodingId = 673,
13626  .membersSize = 2,
13627  .members = WriteRequest_members },
13628 
13629 /* ObjectAttributes */
13630 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 352},
13631  .typeIndex = UA_TYPES_OBJECTATTRIBUTES,
13632 #ifdef UA_ENABLE_TYPENAMES
13633  .typeName = "ObjectAttributes",
13634 #endif
13635  .memSize = sizeof(UA_ObjectAttributes),
13636  .builtin = false,
13637  .fixedSize = false,
13638  .overlayable = false,
13639  .binaryEncodingId = 354,
13640  .membersSize = 6,
13641  .members = ObjectAttributes_members },
13642 
13643 /* BrowseDescription */
13644 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 514},
13645  .typeIndex = UA_TYPES_BROWSEDESCRIPTION,
13646 #ifdef UA_ENABLE_TYPENAMES
13647  .typeName = "BrowseDescription",
13648 #endif
13649  .memSize = sizeof(UA_BrowseDescription),
13650  .builtin = false,
13651  .fixedSize = false,
13652  .overlayable = false,
13653  .binaryEncodingId = 516,
13654  .membersSize = 6,
13655  .members = BrowseDescription_members },
13656 
13657 /* RepublishRequest */
13658 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 830},
13659  .typeIndex = UA_TYPES_REPUBLISHREQUEST,
13660 #ifdef UA_ENABLE_TYPENAMES
13661  .typeName = "RepublishRequest",
13662 #endif
13663  .memSize = sizeof(UA_RepublishRequest),
13664  .builtin = false,
13665  .fixedSize = false,
13666  .overlayable = false,
13667  .binaryEncodingId = 832,
13668  .membersSize = 3,
13669  .members = RepublishRequest_members },
13670 
13671 /* GetEndpointsRequest */
13672 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 426},
13673  .typeIndex = UA_TYPES_GETENDPOINTSREQUEST,
13674 #ifdef UA_ENABLE_TYPENAMES
13675  .typeName = "GetEndpointsRequest",
13676 #endif
13677  .memSize = sizeof(UA_GetEndpointsRequest),
13678  .builtin = false,
13679  .fixedSize = false,
13680  .overlayable = false,
13681  .binaryEncodingId = 428,
13682  .membersSize = 4,
13683  .members = GetEndpointsRequest_members },
13684 
13685 /* PublishRequest */
13686 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 824},
13687  .typeIndex = UA_TYPES_PUBLISHREQUEST,
13688 #ifdef UA_ENABLE_TYPENAMES
13689  .typeName = "PublishRequest",
13690 #endif
13691  .memSize = sizeof(UA_PublishRequest),
13692  .builtin = false,
13693  .fixedSize = false,
13694  .overlayable = false,
13695  .binaryEncodingId = 826,
13696  .membersSize = 2,
13697  .members = PublishRequest_members },
13698 
13699 /* AddNodesResponse */
13700 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 489},
13701  .typeIndex = UA_TYPES_ADDNODESRESPONSE,
13702 #ifdef UA_ENABLE_TYPENAMES
13703  .typeName = "AddNodesResponse",
13704 #endif
13705  .memSize = sizeof(UA_AddNodesResponse),
13706  .builtin = false,
13707  .fixedSize = false,
13708  .overlayable = false,
13709  .binaryEncodingId = 491,
13710  .membersSize = 3,
13711  .members = AddNodesResponse_members },
13712 
13713 /* DataChangeNotification */
13714 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 809},
13715  .typeIndex = UA_TYPES_DATACHANGENOTIFICATION,
13716 #ifdef UA_ENABLE_TYPENAMES
13717  .typeName = "DataChangeNotification",
13718 #endif
13719  .memSize = sizeof(UA_DataChangeNotification),
13720  .builtin = false,
13721  .fixedSize = false,
13722  .overlayable = false,
13723  .binaryEncodingId = 811,
13724  .membersSize = 2,
13725  .members = DataChangeNotification_members },
13726 
13727 /* CloseSecureChannelResponse */
13728 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 453},
13730 #ifdef UA_ENABLE_TYPENAMES
13731  .typeName = "CloseSecureChannelResponse",
13732 #endif
13733  .memSize = sizeof(UA_CloseSecureChannelResponse),
13734  .builtin = false,
13735  .fixedSize = false,
13736  .overlayable = false,
13737  .binaryEncodingId = 455,
13738  .membersSize = 1,
13739  .members = CloseSecureChannelResponse_members },
13740 
13741 /* ModifyMonitoredItemsRequest */
13742 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 761},
13744 #ifdef UA_ENABLE_TYPENAMES
13745  .typeName = "ModifyMonitoredItemsRequest",
13746 #endif
13747  .memSize = sizeof(UA_ModifyMonitoredItemsRequest),
13748  .builtin = false,
13749  .fixedSize = false,
13750  .overlayable = false,
13751  .binaryEncodingId = 763,
13752  .membersSize = 4,
13753  .members = ModifyMonitoredItemsRequest_members },
13754 
13755 /* SetMonitoringModeResponse */
13756 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 770},
13758 #ifdef UA_ENABLE_TYPENAMES
13759  .typeName = "SetMonitoringModeResponse",
13760 #endif
13761  .memSize = sizeof(UA_SetMonitoringModeResponse),
13762  .builtin = false,
13763  .fixedSize = false,
13764  .overlayable = false,
13765  .binaryEncodingId = 772,
13766  .membersSize = 3,
13767  .members = SetMonitoringModeResponse_members },
13768 
13769 /* FindServersRequest */
13770 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 420},
13771  .typeIndex = UA_TYPES_FINDSERVERSREQUEST,
13772 #ifdef UA_ENABLE_TYPENAMES
13773  .typeName = "FindServersRequest",
13774 #endif
13775  .memSize = sizeof(UA_FindServersRequest),
13776  .builtin = false,
13777  .fixedSize = false,
13778  .overlayable = false,
13779  .binaryEncodingId = 422,
13780  .membersSize = 4,
13781  .members = FindServersRequest_members },
13782 
13783 /* ReferenceDescription */
13784 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 518},
13785  .typeIndex = UA_TYPES_REFERENCEDESCRIPTION,
13786 #ifdef UA_ENABLE_TYPENAMES
13787  .typeName = "ReferenceDescription",
13788 #endif
13789  .memSize = sizeof(UA_ReferenceDescription),
13790  .builtin = false,
13791  .fixedSize = false,
13792  .overlayable = false,
13793  .binaryEncodingId = 520,
13794  .membersSize = 7,
13795  .members = ReferenceDescription_members },
13796 
13797 /* SetPublishingModeResponse */
13798 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 800},
13800 #ifdef UA_ENABLE_TYPENAMES
13801  .typeName = "SetPublishingModeResponse",
13802 #endif
13803  .memSize = sizeof(UA_SetPublishingModeResponse),
13804  .builtin = false,
13805  .fixedSize = false,
13806  .overlayable = false,
13807  .binaryEncodingId = 802,
13808  .membersSize = 3,
13809  .members = SetPublishingModeResponse_members },
13810 
13811 /* ContentFilterResult */
13812 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 607},
13813  .typeIndex = UA_TYPES_CONTENTFILTERRESULT,
13814 #ifdef UA_ENABLE_TYPENAMES
13815  .typeName = "ContentFilterResult",
13816 #endif
13817  .memSize = sizeof(UA_ContentFilterResult),
13818  .builtin = false,
13819  .fixedSize = false,
13820  .overlayable = false,
13821  .binaryEncodingId = 609,
13822  .membersSize = 2,
13823  .members = ContentFilterResult_members },
13824 
13825 /* AddReferencesItem */
13826 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 379},
13827  .typeIndex = UA_TYPES_ADDREFERENCESITEM,
13828 #ifdef UA_ENABLE_TYPENAMES
13829  .typeName = "AddReferencesItem",
13830 #endif
13831  .memSize = sizeof(UA_AddReferencesItem),
13832  .builtin = false,
13833  .fixedSize = false,
13834  .overlayable = false,
13835  .binaryEncodingId = 381,
13836  .membersSize = 6,
13837  .members = AddReferencesItem_members },
13838 
13839 /* CreateSubscriptionResponse */
13840 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 788},
13842 #ifdef UA_ENABLE_TYPENAMES
13843  .typeName = "CreateSubscriptionResponse",
13844 #endif
13845  .memSize = sizeof(UA_CreateSubscriptionResponse),
13846  .builtin = false,
13847  .fixedSize = false,
13848  .overlayable = false,
13849  .binaryEncodingId = 790,
13850  .membersSize = 5,
13851  .members = CreateSubscriptionResponse_members },
13852 
13853 /* DeleteSubscriptionsResponse */
13854 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 848},
13856 #ifdef UA_ENABLE_TYPENAMES
13857  .typeName = "DeleteSubscriptionsResponse",
13858 #endif
13859  .memSize = sizeof(UA_DeleteSubscriptionsResponse),
13860  .builtin = false,
13861  .fixedSize = false,
13862  .overlayable = false,
13863  .binaryEncodingId = 850,
13864  .membersSize = 3,
13865  .members = DeleteSubscriptionsResponse_members },
13866 
13867 /* RelativePath */
13868 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 540},
13869  .typeIndex = UA_TYPES_RELATIVEPATH,
13870 #ifdef UA_ENABLE_TYPENAMES
13871  .typeName = "RelativePath",
13872 #endif
13873  .memSize = sizeof(UA_RelativePath),
13874  .builtin = false,
13875  .fixedSize = false,
13876  .overlayable = false,
13877  .binaryEncodingId = 542,
13878  .membersSize = 1,
13879  .members = RelativePath_members },
13880 
13881 /* DeleteReferencesResponse */
13882 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 507},
13883  .typeIndex = UA_TYPES_DELETEREFERENCESRESPONSE,
13884 #ifdef UA_ENABLE_TYPENAMES
13885  .typeName = "DeleteReferencesResponse",
13886 #endif
13887  .memSize = sizeof(UA_DeleteReferencesResponse),
13888  .builtin = false,
13889  .fixedSize = false,
13890  .overlayable = false,
13891  .binaryEncodingId = 509,
13892  .membersSize = 3,
13893  .members = DeleteReferencesResponse_members },
13894 
13895 /* CreateMonitoredItemsResponse */
13896 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 752},
13898 #ifdef UA_ENABLE_TYPENAMES
13899  .typeName = "CreateMonitoredItemsResponse",
13900 #endif
13901  .memSize = sizeof(UA_CreateMonitoredItemsResponse),
13902  .builtin = false,
13903  .fixedSize = false,
13904  .overlayable = false,
13905  .binaryEncodingId = 754,
13906  .membersSize = 3,
13907  .members = CreateMonitoredItemsResponse_members },
13908 
13909 /* CallResponse */
13910 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 713},
13911  .typeIndex = UA_TYPES_CALLRESPONSE,
13912 #ifdef UA_ENABLE_TYPENAMES
13913  .typeName = "CallResponse",
13914 #endif
13915  .memSize = sizeof(UA_CallResponse),
13916  .builtin = false,
13917  .fixedSize = false,
13918  .overlayable = false,
13919  .binaryEncodingId = 715,
13920  .membersSize = 3,
13921  .members = CallResponse_members },
13922 
13923 /* DeleteNodesResponse */
13924 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 501},
13925  .typeIndex = UA_TYPES_DELETENODESRESPONSE,
13926 #ifdef UA_ENABLE_TYPENAMES
13927  .typeName = "DeleteNodesResponse",
13928 #endif
13929  .memSize = sizeof(UA_DeleteNodesResponse),
13930  .builtin = false,
13931  .fixedSize = false,
13932  .overlayable = false,
13933  .binaryEncodingId = 503,
13934  .membersSize = 3,
13935  .members = DeleteNodesResponse_members },
13936 
13937 /* RepublishResponse */
13938 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 833},
13939  .typeIndex = UA_TYPES_REPUBLISHRESPONSE,
13940 #ifdef UA_ENABLE_TYPENAMES
13941  .typeName = "RepublishResponse",
13942 #endif
13943  .memSize = sizeof(UA_RepublishResponse),
13944  .builtin = false,
13945  .fixedSize = false,
13946  .overlayable = false,
13947  .binaryEncodingId = 835,
13948  .membersSize = 2,
13949  .members = RepublishResponse_members },
13950 
13951 /* MonitoredItemCreateRequest */
13952 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 743},
13954 #ifdef UA_ENABLE_TYPENAMES
13955  .typeName = "MonitoredItemCreateRequest",
13956 #endif
13957  .memSize = sizeof(UA_MonitoredItemCreateRequest),
13958  .builtin = false,
13959  .fixedSize = false,
13960  .overlayable = false,
13961  .binaryEncodingId = 745,
13962  .membersSize = 3,
13963  .members = MonitoredItemCreateRequest_members },
13964 
13965 /* DeleteReferencesRequest */
13966 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 504},
13967  .typeIndex = UA_TYPES_DELETEREFERENCESREQUEST,
13968 #ifdef UA_ENABLE_TYPENAMES
13969  .typeName = "DeleteReferencesRequest",
13970 #endif
13971  .memSize = sizeof(UA_DeleteReferencesRequest),
13972  .builtin = false,
13973  .fixedSize = false,
13974  .overlayable = false,
13975  .binaryEncodingId = 506,
13976  .membersSize = 2,
13977  .members = DeleteReferencesRequest_members },
13978 
13979 /* ModifyMonitoredItemsResponse */
13980 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 764},
13982 #ifdef UA_ENABLE_TYPENAMES
13983  .typeName = "ModifyMonitoredItemsResponse",
13984 #endif
13985  .memSize = sizeof(UA_ModifyMonitoredItemsResponse),
13986  .builtin = false,
13987  .fixedSize = false,
13988  .overlayable = false,
13989  .binaryEncodingId = 766,
13990  .membersSize = 3,
13991  .members = ModifyMonitoredItemsResponse_members },
13992 
13993 /* ReadResponse */
13994 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 632},
13995  .typeIndex = UA_TYPES_READRESPONSE,
13996 #ifdef UA_ENABLE_TYPENAMES
13997  .typeName = "ReadResponse",
13998 #endif
13999  .memSize = sizeof(UA_ReadResponse),
14000  .builtin = false,
14001  .fixedSize = false,
14002  .overlayable = false,
14003  .binaryEncodingId = 634,
14004  .membersSize = 3,
14005  .members = ReadResponse_members },
14006 
14007 /* AddReferencesRequest */
14008 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 492},
14009  .typeIndex = UA_TYPES_ADDREFERENCESREQUEST,
14010 #ifdef UA_ENABLE_TYPENAMES
14011  .typeName = "AddReferencesRequest",
14012 #endif
14013  .memSize = sizeof(UA_AddReferencesRequest),
14014  .builtin = false,
14015  .fixedSize = false,
14016  .overlayable = false,
14017  .binaryEncodingId = 494,
14018  .membersSize = 2,
14019  .members = AddReferencesRequest_members },
14020 
14021 /* ReadRequest */
14022 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 629},
14023  .typeIndex = UA_TYPES_READREQUEST,
14024 #ifdef UA_ENABLE_TYPENAMES
14025  .typeName = "ReadRequest",
14026 #endif
14027  .memSize = sizeof(UA_ReadRequest),
14028  .builtin = false,
14029  .fixedSize = false,
14030  .overlayable = false,
14031  .binaryEncodingId = 631,
14032  .membersSize = 4,
14033  .members = ReadRequest_members },
14034 
14035 /* AddNodesItem */
14036 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 376},
14037  .typeIndex = UA_TYPES_ADDNODESITEM,
14038 #ifdef UA_ENABLE_TYPENAMES
14039  .typeName = "AddNodesItem",
14040 #endif
14041  .memSize = sizeof(UA_AddNodesItem),
14042  .builtin = false,
14043  .fixedSize = false,
14044  .overlayable = false,
14045  .binaryEncodingId = 378,
14046  .membersSize = 7,
14047  .members = AddNodesItem_members },
14048 
14049 /* ServerStatusDataType */
14050 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 862},
14051  .typeIndex = UA_TYPES_SERVERSTATUSDATATYPE,
14052 #ifdef UA_ENABLE_TYPENAMES
14053  .typeName = "ServerStatusDataType",
14054 #endif
14055  .memSize = sizeof(UA_ServerStatusDataType),
14056  .builtin = false,
14057  .fixedSize = false,
14058  .overlayable = false,
14059  .binaryEncodingId = 864,
14060  .membersSize = 6,
14061  .members = ServerStatusDataType_members },
14062 
14063 /* AddReferencesResponse */
14064 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 495},
14065  .typeIndex = UA_TYPES_ADDREFERENCESRESPONSE,
14066 #ifdef UA_ENABLE_TYPENAMES
14067  .typeName = "AddReferencesResponse",
14068 #endif
14069  .memSize = sizeof(UA_AddReferencesResponse),
14070  .builtin = false,
14071  .fixedSize = false,
14072  .overlayable = false,
14073  .binaryEncodingId = 497,
14074  .membersSize = 3,
14075  .members = AddReferencesResponse_members },
14076 
14077 /* TranslateBrowsePathsToNodeIdsResponse */
14078 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 555},
14080 #ifdef UA_ENABLE_TYPENAMES
14081  .typeName = "TranslateBrowsePathsToNodeIdsResponse",
14082 #endif
14083  .memSize = sizeof(UA_TranslateBrowsePathsToNodeIdsResponse),
14084  .builtin = false,
14085  .fixedSize = false,
14086  .overlayable = false,
14087  .binaryEncodingId = 557,
14088  .membersSize = 3,
14089  .members = TranslateBrowsePathsToNodeIdsResponse_members },
14090 
14091 /* DataChangeFilter */
14092 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 722},
14093  .typeIndex = UA_TYPES_DATACHANGEFILTER,
14094 #ifdef UA_ENABLE_TYPENAMES
14095  .typeName = "DataChangeFilter",
14096 #endif
14097  .memSize = sizeof(UA_DataChangeFilter),
14098  .builtin = false,
14099  .fixedSize = true,
14100  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_DataChangeFilter, deadbandType) == (offsetof(UA_DataChangeFilter, trigger) + sizeof(UA_DataChangeTrigger)) && UA_BINARY_OVERLAYABLE_FLOAT && offsetof(UA_DataChangeFilter, deadbandValue) == (offsetof(UA_DataChangeFilter, deadbandType) + sizeof(UA_UInt32)),
14101  .binaryEncodingId = 724,
14102  .membersSize = 3,
14103  .members = DataChangeFilter_members },
14104 
14105 /* ContentFilterElement */
14106 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 583},
14107  .typeIndex = UA_TYPES_CONTENTFILTERELEMENT,
14108 #ifdef UA_ENABLE_TYPENAMES
14109  .typeName = "ContentFilterElement",
14110 #endif
14111  .memSize = sizeof(UA_ContentFilterElement),
14112  .builtin = false,
14113  .fixedSize = false,
14114  .overlayable = false,
14115  .binaryEncodingId = 585,
14116  .membersSize = 2,
14117  .members = ContentFilterElement_members },
14118 
14119 /* CloseSessionResponse */
14120 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 474},
14121  .typeIndex = UA_TYPES_CLOSESESSIONRESPONSE,
14122 #ifdef UA_ENABLE_TYPENAMES
14123  .typeName = "CloseSessionResponse",
14124 #endif
14125  .memSize = sizeof(UA_CloseSessionResponse),
14126  .builtin = false,
14127  .fixedSize = false,
14128  .overlayable = false,
14129  .binaryEncodingId = 476,
14130  .membersSize = 1,
14131  .members = CloseSessionResponse_members },
14132 
14133 /* ApplicationDescription */
14134 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 308},
14135  .typeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
14136 #ifdef UA_ENABLE_TYPENAMES
14137  .typeName = "ApplicationDescription",
14138 #endif
14139  .memSize = sizeof(UA_ApplicationDescription),
14140  .builtin = false,
14141  .fixedSize = false,
14142  .overlayable = false,
14143  .binaryEncodingId = 310,
14144  .membersSize = 7,
14145  .members = ApplicationDescription_members },
14146 
14147 /* ServiceFault */
14148 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 395},
14149  .typeIndex = UA_TYPES_SERVICEFAULT,
14150 #ifdef UA_ENABLE_TYPENAMES
14151  .typeName = "ServiceFault",
14152 #endif
14153  .memSize = sizeof(UA_ServiceFault),
14154  .builtin = false,
14155  .fixedSize = false,
14156  .overlayable = false,
14157  .binaryEncodingId = 397,
14158  .membersSize = 1,
14159  .members = ServiceFault_members },
14160 
14161 /* FindServersResponse */
14162 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 423},
14163  .typeIndex = UA_TYPES_FINDSERVERSRESPONSE,
14164 #ifdef UA_ENABLE_TYPENAMES
14165  .typeName = "FindServersResponse",
14166 #endif
14167  .memSize = sizeof(UA_FindServersResponse),
14168  .builtin = false,
14169  .fixedSize = false,
14170  .overlayable = false,
14171  .binaryEncodingId = 425,
14172  .membersSize = 2,
14173  .members = FindServersResponse_members },
14174 
14175 /* CreateMonitoredItemsRequest */
14176 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 749},
14178 #ifdef UA_ENABLE_TYPENAMES
14179  .typeName = "CreateMonitoredItemsRequest",
14180 #endif
14181  .memSize = sizeof(UA_CreateMonitoredItemsRequest),
14182  .builtin = false,
14183  .fixedSize = false,
14184  .overlayable = false,
14185  .binaryEncodingId = 751,
14186  .membersSize = 4,
14187  .members = CreateMonitoredItemsRequest_members },
14188 
14189 /* ContentFilter */
14190 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 586},
14191  .typeIndex = UA_TYPES_CONTENTFILTER,
14192 #ifdef UA_ENABLE_TYPENAMES
14193  .typeName = "ContentFilter",
14194 #endif
14195  .memSize = sizeof(UA_ContentFilter),
14196  .builtin = false,
14197  .fixedSize = false,
14198  .overlayable = false,
14199  .binaryEncodingId = 588,
14200  .membersSize = 1,
14201  .members = ContentFilter_members },
14202 
14203 /* QueryFirstResponse */
14204 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 616},
14205  .typeIndex = UA_TYPES_QUERYFIRSTRESPONSE,
14206 #ifdef UA_ENABLE_TYPENAMES
14207  .typeName = "QueryFirstResponse",
14208 #endif
14209  .memSize = sizeof(UA_QueryFirstResponse),
14210  .builtin = false,
14211  .fixedSize = false,
14212  .overlayable = false,
14213  .binaryEncodingId = 618,
14214  .membersSize = 6,
14215  .members = QueryFirstResponse_members },
14216 
14217 /* AddNodesRequest */
14218 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 486},
14219  .typeIndex = UA_TYPES_ADDNODESREQUEST,
14220 #ifdef UA_ENABLE_TYPENAMES
14221  .typeName = "AddNodesRequest",
14222 #endif
14223  .memSize = sizeof(UA_AddNodesRequest),
14224  .builtin = false,
14225  .fixedSize = false,
14226  .overlayable = false,
14227  .binaryEncodingId = 488,
14228  .membersSize = 2,
14229  .members = AddNodesRequest_members },
14230 
14231 /* BrowseRequest */
14232 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 525},
14233  .typeIndex = UA_TYPES_BROWSEREQUEST,
14234 #ifdef UA_ENABLE_TYPENAMES
14235  .typeName = "BrowseRequest",
14236 #endif
14237  .memSize = sizeof(UA_BrowseRequest),
14238  .builtin = false,
14239  .fixedSize = false,
14240  .overlayable = false,
14241  .binaryEncodingId = 527,
14242  .membersSize = 4,
14243  .members = BrowseRequest_members },
14244 
14245 /* BrowsePath */
14246 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 543},
14247  .typeIndex = UA_TYPES_BROWSEPATH,
14248 #ifdef UA_ENABLE_TYPENAMES
14249  .typeName = "BrowsePath",
14250 #endif
14251  .memSize = sizeof(UA_BrowsePath),
14252  .builtin = false,
14253  .fixedSize = false,
14254  .overlayable = false,
14255  .binaryEncodingId = 545,
14256  .membersSize = 2,
14257  .members = BrowsePath_members },
14258 
14259 /* BrowseResult */
14260 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 522},
14261  .typeIndex = UA_TYPES_BROWSERESULT,
14262 #ifdef UA_ENABLE_TYPENAMES
14263  .typeName = "BrowseResult",
14264 #endif
14265  .memSize = sizeof(UA_BrowseResult),
14266  .builtin = false,
14267  .fixedSize = false,
14268  .overlayable = false,
14269  .binaryEncodingId = 524,
14270  .membersSize = 3,
14271  .members = BrowseResult_members },
14272 
14273 /* CreateSessionRequest */
14274 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 459},
14275  .typeIndex = UA_TYPES_CREATESESSIONREQUEST,
14276 #ifdef UA_ENABLE_TYPENAMES
14277  .typeName = "CreateSessionRequest",
14278 #endif
14279  .memSize = sizeof(UA_CreateSessionRequest),
14280  .builtin = false,
14281  .fixedSize = false,
14282  .overlayable = false,
14283  .binaryEncodingId = 461,
14284  .membersSize = 9,
14285  .members = CreateSessionRequest_members },
14286 
14287 /* QueryDataDescription */
14288 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 570},
14289  .typeIndex = UA_TYPES_QUERYDATADESCRIPTION,
14290 #ifdef UA_ENABLE_TYPENAMES
14291  .typeName = "QueryDataDescription",
14292 #endif
14293  .memSize = sizeof(UA_QueryDataDescription),
14294  .builtin = false,
14295  .fixedSize = false,
14296  .overlayable = false,
14297  .binaryEncodingId = 572,
14298  .membersSize = 3,
14299  .members = QueryDataDescription_members },
14300 
14301 /* EndpointDescription */
14302 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 312},
14303  .typeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
14304 #ifdef UA_ENABLE_TYPENAMES
14305  .typeName = "EndpointDescription",
14306 #endif
14307  .memSize = sizeof(UA_EndpointDescription),
14308  .builtin = false,
14309  .fixedSize = false,
14310  .overlayable = false,
14311  .binaryEncodingId = 314,
14312  .membersSize = 8,
14313  .members = EndpointDescription_members },
14314 
14315 /* GetEndpointsResponse */
14316 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 429},
14317  .typeIndex = UA_TYPES_GETENDPOINTSRESPONSE,
14318 #ifdef UA_ENABLE_TYPENAMES
14319  .typeName = "GetEndpointsResponse",
14320 #endif
14321  .memSize = sizeof(UA_GetEndpointsResponse),
14322  .builtin = false,
14323  .fixedSize = false,
14324  .overlayable = false,
14325  .binaryEncodingId = 431,
14326  .membersSize = 2,
14327  .members = GetEndpointsResponse_members },
14328 
14329 /* NodeTypeDescription */
14330 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 573},
14331  .typeIndex = UA_TYPES_NODETYPEDESCRIPTION,
14332 #ifdef UA_ENABLE_TYPENAMES
14333  .typeName = "NodeTypeDescription",
14334 #endif
14335  .memSize = sizeof(UA_NodeTypeDescription),
14336  .builtin = false,
14337  .fixedSize = false,
14338  .overlayable = false,
14339  .binaryEncodingId = 575,
14340  .membersSize = 3,
14341  .members = NodeTypeDescription_members },
14342 
14343 /* BrowseNextResponse */
14344 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 534},
14345  .typeIndex = UA_TYPES_BROWSENEXTRESPONSE,
14346 #ifdef UA_ENABLE_TYPENAMES
14347  .typeName = "BrowseNextResponse",
14348 #endif
14349  .memSize = sizeof(UA_BrowseNextResponse),
14350  .builtin = false,
14351  .fixedSize = false,
14352  .overlayable = false,
14353  .binaryEncodingId = 536,
14354  .membersSize = 3,
14355  .members = BrowseNextResponse_members },
14356 
14357 /* TranslateBrowsePathsToNodeIdsRequest */
14358 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 552},
14360 #ifdef UA_ENABLE_TYPENAMES
14361  .typeName = "TranslateBrowsePathsToNodeIdsRequest",
14362 #endif
14363  .memSize = sizeof(UA_TranslateBrowsePathsToNodeIdsRequest),
14364  .builtin = false,
14365  .fixedSize = false,
14366  .overlayable = false,
14367  .binaryEncodingId = 554,
14368  .membersSize = 2,
14369  .members = TranslateBrowsePathsToNodeIdsRequest_members },
14370 
14371 /* BrowseResponse */
14372 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 528},
14373  .typeIndex = UA_TYPES_BROWSERESPONSE,
14374 #ifdef UA_ENABLE_TYPENAMES
14375  .typeName = "BrowseResponse",
14376 #endif
14377  .memSize = sizeof(UA_BrowseResponse),
14378  .builtin = false,
14379  .fixedSize = false,
14380  .overlayable = false,
14381  .binaryEncodingId = 530,
14382  .membersSize = 3,
14383  .members = BrowseResponse_members },
14384 
14385 /* CreateSessionResponse */
14386 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 462},
14387  .typeIndex = UA_TYPES_CREATESESSIONRESPONSE,
14388 #ifdef UA_ENABLE_TYPENAMES
14389  .typeName = "CreateSessionResponse",
14390 #endif
14391  .memSize = sizeof(UA_CreateSessionResponse),
14392  .builtin = false,
14393  .fixedSize = false,
14394  .overlayable = false,
14395  .binaryEncodingId = 464,
14396  .membersSize = 10,
14397  .members = CreateSessionResponse_members },
14398 
14399 /* QueryFirstRequest */
14400 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 613},
14401  .typeIndex = UA_TYPES_QUERYFIRSTREQUEST,
14402 #ifdef UA_ENABLE_TYPENAMES
14403  .typeName = "QueryFirstRequest",
14404 #endif
14405  .memSize = sizeof(UA_QueryFirstRequest),
14406  .builtin = false,
14407  .fixedSize = false,
14408  .overlayable = false,
14409  .binaryEncodingId = 615,
14410  .membersSize = 6,
14411  .members = QueryFirstRequest_members },
14412 };
14413 
14414 
14415 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated.c" ***********************************/
14416 
14417 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
14418  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
14419 
14420 
14421 /* SecureConversationMessageAbortBody */
14422 static UA_DataTypeMember SecureConversationMessageAbortBody_members[2] = {
14424 #ifdef UA_ENABLE_TYPENAMES
14425  .memberName = "error",
14426 #endif
14427  .namespaceZero = true,
14428  .padding = 0,
14429  .isArray = false
14430  },
14431  { .memberTypeIndex = UA_TYPES_STRING,
14432 #ifdef UA_ENABLE_TYPENAMES
14433  .memberName = "reason",
14434 #endif
14435  .namespaceZero = true,
14436  .padding = offsetof(UA_SecureConversationMessageAbortBody, reason) - offsetof(UA_SecureConversationMessageAbortBody, error) - sizeof(UA_UInt32),
14437  .isArray = false
14438  },};
14439 
14440 /* SecureConversationMessageFooter */
14441 static UA_DataTypeMember SecureConversationMessageFooter_members[2] = {
14443 #ifdef UA_ENABLE_TYPENAMES
14444  .memberName = "padding",
14445 #endif
14446  .namespaceZero = true,
14447  .padding = 0,
14448  .isArray = true
14449  },
14450  { .memberTypeIndex = UA_TYPES_BYTE,
14451 #ifdef UA_ENABLE_TYPENAMES
14452  .memberName = "signature",
14453 #endif
14454  .namespaceZero = true,
14455  .padding = offsetof(UA_SecureConversationMessageFooter, signature) - offsetof(UA_SecureConversationMessageFooter, padding) - sizeof(void*),
14456  .isArray = false
14457  },};
14458 
14459 /* TcpHelloMessage */
14460 static UA_DataTypeMember TcpHelloMessage_members[6] = {
14462 #ifdef UA_ENABLE_TYPENAMES
14463  .memberName = "protocolVersion",
14464 #endif
14465  .namespaceZero = true,
14466  .padding = 0,
14467  .isArray = false
14468  },
14469  { .memberTypeIndex = UA_TYPES_UINT32,
14470 #ifdef UA_ENABLE_TYPENAMES
14471  .memberName = "receiveBufferSize",
14472 #endif
14473  .namespaceZero = true,
14474  .padding = offsetof(UA_TcpHelloMessage, receiveBufferSize) - offsetof(UA_TcpHelloMessage, protocolVersion) - sizeof(UA_UInt32),
14475  .isArray = false
14476  },
14477  { .memberTypeIndex = UA_TYPES_UINT32,
14478 #ifdef UA_ENABLE_TYPENAMES
14479  .memberName = "sendBufferSize",
14480 #endif
14481  .namespaceZero = true,
14482  .padding = offsetof(UA_TcpHelloMessage, sendBufferSize) - offsetof(UA_TcpHelloMessage, receiveBufferSize) - sizeof(UA_UInt32),
14483  .isArray = false
14484  },
14485  { .memberTypeIndex = UA_TYPES_UINT32,
14486 #ifdef UA_ENABLE_TYPENAMES
14487  .memberName = "maxMessageSize",
14488 #endif
14489  .namespaceZero = true,
14490  .padding = offsetof(UA_TcpHelloMessage, maxMessageSize) - offsetof(UA_TcpHelloMessage, sendBufferSize) - sizeof(UA_UInt32),
14491  .isArray = false
14492  },
14493  { .memberTypeIndex = UA_TYPES_UINT32,
14494 #ifdef UA_ENABLE_TYPENAMES
14495  .memberName = "maxChunkCount",
14496 #endif
14497  .namespaceZero = true,
14498  .padding = offsetof(UA_TcpHelloMessage, maxChunkCount) - offsetof(UA_TcpHelloMessage, maxMessageSize) - sizeof(UA_UInt32),
14499  .isArray = false
14500  },
14501  { .memberTypeIndex = UA_TYPES_STRING,
14502 #ifdef UA_ENABLE_TYPENAMES
14503  .memberName = "endpointUrl",
14504 #endif
14505  .namespaceZero = true,
14506  .padding = offsetof(UA_TcpHelloMessage, endpointUrl) - offsetof(UA_TcpHelloMessage, maxChunkCount) - sizeof(UA_UInt32),
14507  .isArray = false
14508  },};
14509 
14510 /* TcpErrorMessage */
14511 static UA_DataTypeMember TcpErrorMessage_members[2] = {
14513 #ifdef UA_ENABLE_TYPENAMES
14514  .memberName = "error",
14515 #endif
14516  .namespaceZero = true,
14517  .padding = 0,
14518  .isArray = false
14519  },
14520  { .memberTypeIndex = UA_TYPES_STRING,
14521 #ifdef UA_ENABLE_TYPENAMES
14522  .memberName = "reason",
14523 #endif
14524  .namespaceZero = true,
14525  .padding = offsetof(UA_TcpErrorMessage, reason) - offsetof(UA_TcpErrorMessage, error) - sizeof(UA_UInt32),
14526  .isArray = false
14527  },};
14528 
14529 /* MessageType */
14530 static UA_DataTypeMember MessageType_members[1] = {
14532 #ifdef UA_ENABLE_TYPENAMES
14533  .memberName = "",
14534 #endif
14535  .namespaceZero = true,
14536  .padding = 0,
14537  .isArray = false
14538  },};
14539 
14540 /* AsymmetricAlgorithmSecurityHeader */
14541 static UA_DataTypeMember AsymmetricAlgorithmSecurityHeader_members[3] = {
14543 #ifdef UA_ENABLE_TYPENAMES
14544  .memberName = "securityPolicyUri",
14545 #endif
14546  .namespaceZero = true,
14547  .padding = 0,
14548  .isArray = false
14549  },
14550  { .memberTypeIndex = UA_TYPES_BYTESTRING,
14551 #ifdef UA_ENABLE_TYPENAMES
14552  .memberName = "senderCertificate",
14553 #endif
14554  .namespaceZero = true,
14555  .padding = offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - offsetof(UA_AsymmetricAlgorithmSecurityHeader, securityPolicyUri) - sizeof(UA_ByteString),
14556  .isArray = false
14557  },
14558  { .memberTypeIndex = UA_TYPES_BYTESTRING,
14559 #ifdef UA_ENABLE_TYPENAMES
14560  .memberName = "receiverCertificateThumbprint",
14561 #endif
14562  .namespaceZero = true,
14563  .padding = offsetof(UA_AsymmetricAlgorithmSecurityHeader, receiverCertificateThumbprint) - offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - sizeof(UA_ByteString),
14564  .isArray = false
14565  },};
14566 
14567 /* TcpAcknowledgeMessage */
14568 static UA_DataTypeMember TcpAcknowledgeMessage_members[5] = {
14570 #ifdef UA_ENABLE_TYPENAMES
14571  .memberName = "protocolVersion",
14572 #endif
14573  .namespaceZero = true,
14574  .padding = 0,
14575  .isArray = false
14576  },
14577  { .memberTypeIndex = UA_TYPES_UINT32,
14578 #ifdef UA_ENABLE_TYPENAMES
14579  .memberName = "receiveBufferSize",
14580 #endif
14581  .namespaceZero = true,
14582  .padding = offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - offsetof(UA_TcpAcknowledgeMessage, protocolVersion) - sizeof(UA_UInt32),
14583  .isArray = false
14584  },
14585  { .memberTypeIndex = UA_TYPES_UINT32,
14586 #ifdef UA_ENABLE_TYPENAMES
14587  .memberName = "sendBufferSize",
14588 #endif
14589  .namespaceZero = true,
14590  .padding = offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - sizeof(UA_UInt32),
14591  .isArray = false
14592  },
14593  { .memberTypeIndex = UA_TYPES_UINT32,
14594 #ifdef UA_ENABLE_TYPENAMES
14595  .memberName = "maxMessageSize",
14596 #endif
14597  .namespaceZero = true,
14598  .padding = offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - sizeof(UA_UInt32),
14599  .isArray = false
14600  },
14601  { .memberTypeIndex = UA_TYPES_UINT32,
14602 #ifdef UA_ENABLE_TYPENAMES
14603  .memberName = "maxChunkCount",
14604 #endif
14605  .namespaceZero = true,
14606  .padding = offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) - offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - sizeof(UA_UInt32),
14607  .isArray = false
14608  },};
14609 
14610 /* SequenceHeader */
14611 static UA_DataTypeMember SequenceHeader_members[2] = {
14613 #ifdef UA_ENABLE_TYPENAMES
14614  .memberName = "sequenceNumber",
14615 #endif
14616  .namespaceZero = true,
14617  .padding = 0,
14618  .isArray = false
14619  },
14620  { .memberTypeIndex = UA_TYPES_UINT32,
14621 #ifdef UA_ENABLE_TYPENAMES
14622  .memberName = "requestId",
14623 #endif
14624  .namespaceZero = true,
14625  .padding = offsetof(UA_SequenceHeader, requestId) - offsetof(UA_SequenceHeader, sequenceNumber) - sizeof(UA_UInt32),
14626  .isArray = false
14627  },};
14628 
14629 /* TcpMessageHeader */
14630 static UA_DataTypeMember TcpMessageHeader_members[2] = {
14632 #ifdef UA_ENABLE_TYPENAMES
14633  .memberName = "messageTypeAndChunkType",
14634 #endif
14635  .namespaceZero = true,
14636  .padding = 0,
14637  .isArray = false
14638  },
14639  { .memberTypeIndex = UA_TYPES_UINT32,
14640 #ifdef UA_ENABLE_TYPENAMES
14641  .memberName = "messageSize",
14642 #endif
14643  .namespaceZero = true,
14644  .padding = offsetof(UA_TcpMessageHeader, messageSize) - offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) - sizeof(UA_UInt32),
14645  .isArray = false
14646  },};
14647 
14648 /* ChunkType */
14649 static UA_DataTypeMember ChunkType_members[1] = {
14651 #ifdef UA_ENABLE_TYPENAMES
14652  .memberName = "",
14653 #endif
14654  .namespaceZero = true,
14655  .padding = 0,
14656  .isArray = false
14657  },};
14658 
14659 /* SymmetricAlgorithmSecurityHeader */
14660 static UA_DataTypeMember SymmetricAlgorithmSecurityHeader_members[1] = {
14662 #ifdef UA_ENABLE_TYPENAMES
14663  .memberName = "tokenId",
14664 #endif
14665  .namespaceZero = true,
14666  .padding = 0,
14667  .isArray = false
14668  },};
14669 
14670 /* SecureConversationMessageHeader */
14671 static UA_DataTypeMember SecureConversationMessageHeader_members[2] = {
14673 #ifdef UA_ENABLE_TYPENAMES
14674  .memberName = "messageHeader",
14675 #endif
14676  .namespaceZero = false,
14677  .padding = 0,
14678  .isArray = false
14679  },
14680  { .memberTypeIndex = UA_TYPES_UINT32,
14681 #ifdef UA_ENABLE_TYPENAMES
14682  .memberName = "secureChannelId",
14683 #endif
14684  .namespaceZero = true,
14685  .padding = offsetof(UA_SecureConversationMessageHeader, secureChannelId) - offsetof(UA_SecureConversationMessageHeader, messageHeader) - sizeof(UA_TcpMessageHeader),
14686  .isArray = false
14687  },};
14688 const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT] = {
14689 
14690 /* SecureConversationMessageAbortBody */
14691 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14693 #ifdef UA_ENABLE_TYPENAMES
14694  .typeName = "SecureConversationMessageAbortBody",
14695 #endif
14696  .memSize = sizeof(UA_SecureConversationMessageAbortBody),
14697  .builtin = false,
14698  .fixedSize = false,
14699  .overlayable = false,
14700  .binaryEncodingId = 0,
14701  .membersSize = 2,
14702  .members = SecureConversationMessageAbortBody_members },
14703 
14704 /* SecureConversationMessageFooter */
14705 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14707 #ifdef UA_ENABLE_TYPENAMES
14708  .typeName = "SecureConversationMessageFooter",
14709 #endif
14710  .memSize = sizeof(UA_SecureConversationMessageFooter),
14711  .builtin = false,
14712  .fixedSize = false,
14713  .overlayable = false,
14714  .binaryEncodingId = 0,
14715  .membersSize = 2,
14716  .members = SecureConversationMessageFooter_members },
14717 
14718 /* TcpHelloMessage */
14719 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14720  .typeIndex = UA_TRANSPORT_TCPHELLOMESSAGE,
14721 #ifdef UA_ENABLE_TYPENAMES
14722  .typeName = "TcpHelloMessage",
14723 #endif
14724  .memSize = sizeof(UA_TcpHelloMessage),
14725  .builtin = false,
14726  .fixedSize = false,
14727  .overlayable = false,
14728  .binaryEncodingId = 0,
14729  .membersSize = 6,
14730  .members = TcpHelloMessage_members },
14731 
14732 /* TcpErrorMessage */
14733 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14734  .typeIndex = UA_TRANSPORT_TCPERRORMESSAGE,
14735 #ifdef UA_ENABLE_TYPENAMES
14736  .typeName = "TcpErrorMessage",
14737 #endif
14738  .memSize = sizeof(UA_TcpErrorMessage),
14739  .builtin = false,
14740  .fixedSize = false,
14741  .overlayable = false,
14742  .binaryEncodingId = 0,
14743  .membersSize = 2,
14744  .members = TcpErrorMessage_members },
14745 
14746 /* MessageType */
14747 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14748  .typeIndex = UA_TYPES_INT32,
14749 #ifdef UA_ENABLE_TYPENAMES
14750  .typeName = "MessageType",
14751 #endif
14752  .memSize = sizeof(UA_MessageType),
14753  .builtin = true,
14754  .fixedSize = true,
14755  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
14756  .binaryEncodingId = 0,
14757  .membersSize = 1,
14758  .members = MessageType_members },
14759 
14760 /* AsymmetricAlgorithmSecurityHeader */
14761 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14763 #ifdef UA_ENABLE_TYPENAMES
14764  .typeName = "AsymmetricAlgorithmSecurityHeader",
14765 #endif
14766  .memSize = sizeof(UA_AsymmetricAlgorithmSecurityHeader),
14767  .builtin = false,
14768  .fixedSize = false,
14769  .overlayable = false,
14770  .binaryEncodingId = 0,
14771  .membersSize = 3,
14772  .members = AsymmetricAlgorithmSecurityHeader_members },
14773 
14774 /* TcpAcknowledgeMessage */
14775 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14777 #ifdef UA_ENABLE_TYPENAMES
14778  .typeName = "TcpAcknowledgeMessage",
14779 #endif
14780  .memSize = sizeof(UA_TcpAcknowledgeMessage),
14781  .builtin = false,
14782  .fixedSize = true,
14783  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) == (offsetof(UA_TcpAcknowledgeMessage, protocolVersion) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) == (offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) == (offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) == (offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) + sizeof(UA_UInt32)),
14784  .binaryEncodingId = 0,
14785  .membersSize = 5,
14786  .members = TcpAcknowledgeMessage_members },
14787 
14788 /* SequenceHeader */
14789 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14790  .typeIndex = UA_TRANSPORT_SEQUENCEHEADER,
14791 #ifdef UA_ENABLE_TYPENAMES
14792  .typeName = "SequenceHeader",
14793 #endif
14794  .memSize = sizeof(UA_SequenceHeader),
14795  .builtin = false,
14796  .fixedSize = true,
14797  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SequenceHeader, requestId) == (offsetof(UA_SequenceHeader, sequenceNumber) + sizeof(UA_UInt32)),
14798  .binaryEncodingId = 0,
14799  .membersSize = 2,
14800  .members = SequenceHeader_members },
14801 
14802 /* TcpMessageHeader */
14803 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14804  .typeIndex = UA_TRANSPORT_TCPMESSAGEHEADER,
14805 #ifdef UA_ENABLE_TYPENAMES
14806  .typeName = "TcpMessageHeader",
14807 #endif
14808  .memSize = sizeof(UA_TcpMessageHeader),
14809  .builtin = false,
14810  .fixedSize = true,
14811  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpMessageHeader, messageSize) == (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)),
14812  .binaryEncodingId = 0,
14813  .membersSize = 2,
14814  .members = TcpMessageHeader_members },
14815 
14816 /* ChunkType */
14817 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14818  .typeIndex = UA_TYPES_INT32,
14819 #ifdef UA_ENABLE_TYPENAMES
14820  .typeName = "ChunkType",
14821 #endif
14822  .memSize = sizeof(UA_ChunkType),
14823  .builtin = true,
14824  .fixedSize = true,
14825  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
14826  .binaryEncodingId = 0,
14827  .membersSize = 1,
14828  .members = ChunkType_members },
14829 
14830 /* SymmetricAlgorithmSecurityHeader */
14831 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14833 #ifdef UA_ENABLE_TYPENAMES
14834  .typeName = "SymmetricAlgorithmSecurityHeader",
14835 #endif
14836  .memSize = sizeof(UA_SymmetricAlgorithmSecurityHeader),
14837  .builtin = false,
14838  .fixedSize = true,
14839  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER,
14840  .binaryEncodingId = 0,
14841  .membersSize = 1,
14842  .members = SymmetricAlgorithmSecurityHeader_members },
14843 
14844 /* SecureConversationMessageHeader */
14845 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14847 #ifdef UA_ENABLE_TYPENAMES
14848  .typeName = "SecureConversationMessageHeader",
14849 #endif
14850  .memSize = sizeof(UA_SecureConversationMessageHeader),
14851  .builtin = false,
14852  .fixedSize = true,
14853  .overlayable = true && true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpMessageHeader, messageSize) == (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SecureConversationMessageHeader, secureChannelId) == (offsetof(UA_SecureConversationMessageHeader, messageHeader) + sizeof(UA_TcpMessageHeader)),
14854  .binaryEncodingId = 0,
14855  .membersSize = 2,
14856  .members = SecureConversationMessageHeader_members },
14857 };
14858 
14859 
14860 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_connection.c" ***********************************/
14861 
14862 /* This Source Code Form is subject to the terms of the Mozilla Public
14863 * License, v. 2.0. If a copy of the MPL was not distributed with this
14864 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
14865 
14866 
14868  UA_ByteString_deleteMembers(&connection->incompleteMessage);
14869 }
14870 
14873  UA_Boolean *realloced) {
14875 
14876  /* We have a stored an incomplete chunk. Concat the received message to the end.
14877  * After this block, connection->incompleteMessage is always empty. */
14878  if(connection->incompleteMessage.length > 0) {
14879  size_t length = connection->incompleteMessage.length + message->length;
14880  UA_Byte *data = (UA_Byte*)UA_realloc(connection->incompleteMessage.data, length);
14881  if(!data) {
14883  goto cleanup;
14884  }
14885  memcpy(&data[connection->incompleteMessage.length], message->data, message->length);
14886  connection->releaseRecvBuffer(connection, message);
14887  message->data = data;
14888  message->length = length;
14889  *realloced = true;
14890  connection->incompleteMessage = UA_BYTESTRING_NULL;
14891  }
14892 
14893  /* Loop over the chunks in the received buffer */
14894  size_t complete_until = 0; /* the received complete chunks end at this point */
14895  UA_Boolean garbage_end = false; /* garbage after the last complete message */
14896  while(message->length - complete_until >= 8) {
14897  /* Check the message type */
14898  UA_UInt32 msgtype = (UA_UInt32)message->data[complete_until] +
14899  ((UA_UInt32)message->data[complete_until+1] << 8) +
14900  ((UA_UInt32)message->data[complete_until+2] << 16);
14901  if(msgtype != ('M' + ('S' << 8) + ('G' << 16)) &&
14902  msgtype != ('E' + ('R' << 8) + ('R' << 16)) &&
14903  msgtype != ('O' + ('P' << 8) + ('N' << 16)) &&
14904  msgtype != ('H' + ('E' << 8) + ('L' << 16)) &&
14905  msgtype != ('A' + ('C' << 8) + ('K' << 16)) &&
14906  msgtype != ('C' + ('L' << 8) + ('O' << 16))) {
14907  garbage_end = true; /* the message type is not recognized */
14908  break;
14909  }
14910 
14911  /* Decode the length of the chunk */
14912  UA_UInt32 chunk_length = 0;
14913  size_t length_pos = complete_until + 4;
14914  UA_StatusCode decode_retval = UA_UInt32_decodeBinary(message, &length_pos, &chunk_length);
14915 
14916  /* The message size is not allowed. Throw the remaining bytestring away */
14917  if(decode_retval != UA_STATUSCODE_GOOD ||
14918  chunk_length < 16 ||
14919  chunk_length > connection->localConf.recvBufferSize) {
14920  garbage_end = true;
14921  break;
14922  }
14923 
14924  /* The chunk is okay but incomplete. Store the end. */
14925  if(chunk_length + complete_until > message->length)
14926  break;
14927 
14928  complete_until += chunk_length; /* Go to the next chunk */
14929  }
14930 
14931  /* Separate incomplete chunks */
14932  if(complete_until != message->length) {
14933  /* Garbage after the last good chunk. No need to keep a buffer */
14934  if(garbage_end) {
14935  if(complete_until == 0)
14936  goto cleanup; /* All garbage, only happens on messages from the network layer */
14937  message->length = complete_until;
14938  return UA_STATUSCODE_GOOD;
14939  }
14940 
14941  /* No good chunk, only an incomplete one */
14942  if(complete_until == 0) {
14943  if(!*realloced) {
14944  retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, message->length);
14945  if(retval != UA_STATUSCODE_GOOD)
14946  goto cleanup;
14947  memcpy(connection->incompleteMessage.data, message->data, message->length);
14948  connection->releaseRecvBuffer(connection, message);
14949  *realloced = true;
14950  } else {
14951  connection->incompleteMessage = *message;
14952  *message = UA_BYTESTRING_NULL;
14953  }
14954  return UA_STATUSCODE_GOOD;
14955  }
14956 
14957  /* At least one good chunk and an incomplete one */
14958  size_t incomplete_length = message->length - complete_until;
14959  retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, incomplete_length);
14960  if(retval != UA_STATUSCODE_GOOD)
14961  goto cleanup;
14962  memcpy(connection->incompleteMessage.data,
14963  &message->data[complete_until], incomplete_length);
14964  message->length = complete_until;
14965  }
14966 
14967  return UA_STATUSCODE_GOOD;
14968 
14969  cleanup:
14970  if(!*realloced)
14971  connection->releaseRecvBuffer(connection, message);
14972  UA_ByteString_deleteMembers(&connection->incompleteMessage);
14973  return retval;
14974 }
14975 
14978  UA_Boolean *realloced, UA_UInt32 timeout) {
14980  UA_DateTime maxDate = now + (timeout * UA_MSEC_TO_DATETIME);
14981  *realloced = false;
14982 
14984  while(true) {
14985  /* Listen for messages to arrive */
14986  retval = connection->recv(connection, chunks, timeout);
14987 
14988  /* Get complete chunks and return */
14989  retval |= UA_Connection_completeMessages(connection, chunks, realloced);
14990  if(retval != UA_STATUSCODE_GOOD || chunks->length > 0)
14991  break;
14992 
14993  /* We received a message. But the chunk is incomplete. Compute the
14994  * remaining timeout. */
14995  now = UA_DateTime_nowMonotonic();
14996  if(now > maxDate)
14998  timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
14999  }
15000  return retval;
15001 }
15002 
15003 
15005  UA_SecureChannel *channel = connection->channel;
15006  if(channel)
15007  /* only replace when the channel points to this connection */
15008  UA_atomic_cmpxchg((void**)&channel->connection, connection, NULL);
15009  UA_atomic_xchg((void**)&connection->channel, NULL);
15010 }
15011 
15012 // TODO: Return an error code
15013 void
15015  UA_SecureChannel *channel) {
15016  if(UA_atomic_cmpxchg((void**)&channel->connection, NULL, connection) == NULL)
15017  UA_atomic_xchg((void**)&connection->channel, (void*)channel);
15018 }
15019 
15021 UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
15022  const char ** port, const char **path) {
15023  if (!endpointUrl || !hostname)
15025 
15026  size_t urlLength = strlen(endpointUrl);
15027  if(urlLength < 10 || urlLength >= 256)
15029 
15030  if(strncmp(endpointUrl, "opc.tcp://", 10) != 0)
15032 
15033  if (urlLength == 10) {
15034  hostname[0] = '\0';
15035  port = NULL;
15036  *path = NULL;
15037  }
15038 
15039  /* where does the port begin? */
15040  size_t portpos = 10;
15041  // opc.tcp://[2001:0db8:85a3::8a2e:0370:7334]:1234/path
15042  // if ip6, then end not found, otherwise we are fine
15043  UA_Boolean ip6_end_found = endpointUrl[portpos] != '[';
15044  for(; portpos < urlLength; ++portpos) {
15045  if (!ip6_end_found) {
15046  if (endpointUrl[portpos] == ']')
15047  ip6_end_found = UA_TRUE;
15048  continue;
15049  }
15050 
15051  if(endpointUrl[portpos] == ':' || endpointUrl[portpos] == '/')
15052  break;
15053  }
15054 
15055  memcpy(hostname, &endpointUrl[10], portpos - 10);
15056  hostname[portpos-10] = 0;
15057 
15058  if(port) {
15059  if (portpos < urlLength - 1) {
15060  if (endpointUrl[portpos] == '/')
15061  *port = NULL;
15062  else
15063  *port = &endpointUrl[portpos + 1];
15064  } else {
15065  *port = NULL;
15066  }
15067  }
15068 
15069  if(path) {
15070  size_t pathpos = portpos < urlLength ? portpos : 10;
15071  for(; pathpos < urlLength; ++pathpos) {
15072  if(endpointUrl[pathpos] == '/')
15073  break;
15074  }
15075  if (pathpos < urlLength-1)
15076  *path = &endpointUrl[pathpos+1]; // do not include slash in path
15077  else
15078  *path = NULL;
15079  }
15080 
15081  return UA_STATUSCODE_GOOD;
15082 }
15083 
15084 
15086 UA_EndpointUrl_split(const char *endpointUrl, char *hostname,
15087  UA_UInt16 * port, const char ** path) {
15088  const char* portTmp = NULL;
15089  const char* pathTmp = NULL;
15090  UA_StatusCode retval = UA_EndpointUrl_split_ptr(endpointUrl, hostname, &portTmp, &pathTmp);
15091  if(retval != UA_STATUSCODE_GOOD) {
15092  if(hostname)
15093  hostname[0] = '\0';
15094  return retval;
15095  }
15096  if(!port && !path)
15097  return UA_STATUSCODE_GOOD;
15098 
15099  char portStr[6];
15100  portStr[0] = '\0';
15101  if(portTmp) {
15102  size_t portLen;
15103  if (pathTmp)
15104  portLen = (size_t)(pathTmp-portTmp-1);
15105  else
15106  portLen = strlen(portTmp);
15107 
15108  if (portLen > 5) // max is 65535
15110 
15111  memcpy(portStr, portTmp, portLen);
15112  portStr[portLen]='\0';
15113 
15114  if(port) {
15115  for (size_t i=0; i<6; ++i) {
15116  if (portStr[i] == 0)
15117  break;
15118  if (portStr[i] < '0' || portStr[i] > '9')
15120  }
15121 
15122  UA_UInt32 p;
15123  UA_readNumber((UA_Byte*)portStr, 6, &p);
15124  if (p>65535)
15126  *port = (UA_UInt16)p;
15127  }
15128  } else {
15129  if (port)
15130  *port = 0;
15131  }
15132  if (path)
15133  *path = pathTmp;
15134  return UA_STATUSCODE_GOOD;
15135 }
15136 
15137 size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number) {
15138  if (!buf)
15139  return 0;
15140  UA_UInt32 n = 0;
15141  size_t progress = 0;
15142  /* read numbers until the end or a non-number character appears */
15143  while(progress < buflen) {
15144  UA_Byte c = buf[progress];
15145  if('0' > c || '9' < c)
15146  break;
15147  n = (n*10) + (UA_UInt32)(c-'0');
15148  ++progress;
15149  }
15150  *number = n;
15151  return progress;
15152 }
15153 
15154 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_securechannel.c" ***********************************/
15155 
15156 /* This Source Code Form is subject to the terms of the Mozilla Public
15157 * License, v. 2.0. If a copy of the MPL was not distributed with this
15158 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15159 
15160 
15161 #define UA_SECURE_MESSAGE_HEADER_LENGTH 24
15162 
15164  memset(channel, 0, sizeof(UA_SecureChannel));
15165  /* Linked lists are also initialized by zeroing out */
15166  /* LIST_INIT(&channel->sessions); */
15167  /* LIST_INIT(&channel->chunks); */
15168 }
15169 
15171  /* Delete members */
15172  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->serverAsymAlgSettings);
15173  UA_ByteString_deleteMembers(&channel->serverNonce);
15174  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->clientAsymAlgSettings);
15175  UA_ByteString_deleteMembers(&channel->clientNonce);
15176  UA_ChannelSecurityToken_deleteMembers(&channel->securityToken);
15177  UA_ChannelSecurityToken_deleteMembers(&channel->nextSecurityToken);
15178 
15179  /* Detach from the channel */
15180  if(channel->connection)
15182 
15183  /* Remove session pointers (not the sessions) */
15184  struct SessionEntry *se, *temp;
15185  LIST_FOREACH_SAFE(se, &channel->sessions, pointers, temp) {
15186  if(se->session)
15187  se->session->channel = NULL;
15188  LIST_REMOVE(se, pointers);
15189  UA_free(se);
15190  }
15191 
15192  /* Remove the buffered chunks */
15193  struct ChunkEntry *ch, *temp_ch;
15194  LIST_FOREACH_SAFE(ch, &channel->chunks, pointers, temp_ch) {
15195  UA_ByteString_deleteMembers(&ch->bytes);
15196  LIST_REMOVE(ch, pointers);
15197  UA_free(ch);
15198  }
15199 }
15200 
15201 //TODO implement real nonce generator - DUMMY function
15203  if(!(nonce->data = UA_malloc(1)))
15205  nonce->length = 1;
15206  nonce->data[0] = 'a';
15207  return UA_STATUSCODE_GOOD;
15208 }
15209 
15210 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
15211 #pragma GCC diagnostic push
15212 #pragma GCC diagnostic ignored "-Wextra"
15213 #pragma GCC diagnostic ignored "-Wcast-qual"
15214 #pragma GCC diagnostic ignored "-Wunused-value"
15215 #endif
15216 
15217 void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session) {
15218  struct SessionEntry *se = UA_malloc(sizeof(struct SessionEntry));
15219  if(!se)
15220  return;
15221  se->session = session;
15222  if(UA_atomic_cmpxchg((void**)&session->channel, NULL, channel) != NULL) {
15223  UA_free(se);
15224  return;
15225  }
15226  LIST_INSERT_HEAD(&channel->sessions, se, pointers);
15227 }
15228 
15229 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
15230 #pragma GCC diagnostic pop
15231 #endif
15232 
15233 void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session) {
15234  if(session)
15235  session->channel = NULL;
15236  struct SessionEntry *se;
15237  LIST_FOREACH(se, &channel->sessions, pointers) {
15238  if(se->session == session)
15239  break;
15240  }
15241  if(!se)
15242  return;
15243  LIST_REMOVE(se, pointers);
15244  UA_free(se);
15245 }
15246 
15248  struct SessionEntry *se;
15249  LIST_FOREACH(se, &channel->sessions, pointers) {
15250  if(UA_NodeId_equal(&se->session->authenticationToken, token))
15251  break;
15252  }
15253  if(!se)
15254  return NULL;
15255  return se->session;
15256 }
15257 
15259  if(channel->nextSecurityToken.tokenId == 0) //no security token issued
15260  return;
15261 
15262  //FIXME: not thread-safe
15263  memcpy(&channel->securityToken, &channel->nextSecurityToken,
15264  sizeof(UA_ChannelSecurityToken));
15265  UA_ChannelSecurityToken_init(&channel->nextSecurityToken);
15266 }
15267 
15268 /***********************/
15269 /* Send Binary Message */
15270 /***********************/
15271 
15272 static UA_StatusCode
15273 UA_SecureChannel_sendChunk(UA_ChunkInfo *ci, UA_ByteString *dst, size_t offset) {
15274  UA_SecureChannel *channel = ci->channel;
15275  UA_Connection *connection = channel->connection;
15276  if(!connection)
15278 
15279  /* adjust the buffer where the header was hidden */
15280  dst->data = &dst->data[-UA_SECURE_MESSAGE_HEADER_LENGTH];
15283 
15284  if(ci->messageSizeSoFar + offset > connection->remoteConf.maxMessageSize &&
15285  connection->remoteConf.maxMessageSize > 0)
15287  if(++ci->chunksSoFar > connection->remoteConf.maxChunkCount &&
15288  connection->remoteConf.maxChunkCount > 0)
15290 
15291  /* Prepare the chunk headers */
15293  respHeader.secureChannelId = channel->securityToken.channelId;
15295  if(ci->errorCode == UA_STATUSCODE_GOOD) {
15296  if(ci->final)
15298  else
15300  } else {
15301  /* abort message */
15302  ci->final = true; /* mark as finished */
15304  UA_String errorMsg;
15305  UA_String_init(&errorMsg);
15307  UA_UInt32_encodeBinary(&ci->errorCode, dst, &offset);
15308  UA_String_encodeBinary(&errorMsg, dst, &offset);
15309  }
15310  respHeader.messageHeader.messageSize = (UA_UInt32)offset;
15311  ci->messageSizeSoFar += offset;
15312 
15313  /* Encode the header at the beginning of the buffer */
15315  symSecHeader.tokenId = channel->securityToken.tokenId;
15316  UA_SequenceHeader seqHeader;
15317  seqHeader.requestId = ci->requestId;
15318  seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1);
15319  size_t offset_header = 0;
15320  UA_SecureConversationMessageHeader_encodeBinary(&respHeader, dst, &offset_header);
15321  UA_SymmetricAlgorithmSecurityHeader_encodeBinary(&symSecHeader, dst, &offset_header);
15322  UA_SequenceHeader_encodeBinary(&seqHeader, dst, &offset_header);
15323 
15324  /* Send the chunk, the buffer is freed in the network layer */
15325  dst->length = offset; /* set the buffer length to the content length */
15326  connection->send(channel->connection, dst);
15327 
15328  /* Replace with the buffer for the next chunk */
15329  if(!ci->final) {
15330  UA_StatusCode retval =
15331  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, dst);
15332  if(retval != UA_STATUSCODE_GOOD)
15333  return retval;
15334  /* Forward the data pointer so that the payload is encoded after the message header.
15335  * TODO: This works but is a bit too clever. Instead, we could return an offset to the
15336  * binary encoding exchangeBuffer function. */
15339  }
15340  return ci->errorCode;
15341 }
15342 
15345  const void *content, const UA_DataType *contentType) {
15346  UA_Connection *connection = channel->connection;
15347  if(!connection)
15349 
15350  /* Allocate the message buffer */
15351  UA_ByteString message;
15352  UA_StatusCode retval =
15353  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &message);
15354  if(retval != UA_STATUSCODE_GOOD)
15355  return retval;
15356 
15357  /* Hide the message beginning where the header will be encoded */
15358  message.data = &message.data[UA_SECURE_MESSAGE_HEADER_LENGTH];
15360 
15361  /* Encode the message type */
15362  size_t messagePos = 0;
15363  UA_NodeId typeId = contentType->typeId; /* always numeric */
15364  typeId.identifier.numeric = contentType->binaryEncodingId;
15365  UA_NodeId_encodeBinary(&typeId, &message, &messagePos);
15366 
15367  /* Encode with the chunking callback */
15368  UA_ChunkInfo ci;
15369  ci.channel = channel;
15370  ci.requestId = requestId;
15371  ci.chunksSoFar = 0;
15372  ci.messageSizeSoFar = 0;
15373  ci.final = false;
15376  if(typeId.identifier.numeric == 446 || typeId.identifier.numeric == 449)
15378  else if(typeId.identifier.numeric == 452 || typeId.identifier.numeric == 455)
15380  retval = UA_encodeBinary(content, contentType,
15381  (UA_exchangeEncodeBuffer)UA_SecureChannel_sendChunk,
15382  &ci, &message, &messagePos);
15383 
15384  /* Encoding failed, release the message */
15385  if(retval != UA_STATUSCODE_GOOD) {
15386  if(!ci.final) {
15387  /* the abort message was not send */
15388  ci.errorCode = retval;
15389  UA_SecureChannel_sendChunk(&ci, &message, messagePos);
15390  }
15391  return retval;
15392  }
15393 
15394  /* Encoding finished, send the final chunk */
15395  ci.final = UA_TRUE;
15396  return UA_SecureChannel_sendChunk(&ci, &message, messagePos);
15397 }
15398 
15399 /***************************/
15400 /* Process Received Chunks */
15401 /***************************/
15402 
15403 static void
15404 UA_SecureChannel_removeChunk(UA_SecureChannel *channel, UA_UInt32 requestId) {
15405  struct ChunkEntry *ch;
15406  LIST_FOREACH(ch, &channel->chunks, pointers) {
15407  if(ch->requestId == requestId) {
15408  UA_ByteString_deleteMembers(&ch->bytes);
15409  LIST_REMOVE(ch, pointers);
15410  UA_free(ch);
15411  return;
15412  }
15413  }
15414 }
15415 
15416 /* assume that chunklength fits */
15417 static void
15418 appendChunk(struct ChunkEntry *ch, const UA_ByteString *msg,
15419  size_t offset, size_t chunklength) {
15420  UA_Byte* new_bytes = UA_realloc(ch->bytes.data, ch->bytes.length + chunklength);
15421  if(!new_bytes) {
15422  UA_ByteString_deleteMembers(&ch->bytes);
15423  return;
15424  }
15425  ch->bytes.data = new_bytes;
15426  memcpy(&ch->bytes.data[ch->bytes.length], &msg->data[offset], chunklength);
15427  ch->bytes.length += chunklength;
15428 }
15429 
15430 static void
15431 UA_SecureChannel_appendChunk(UA_SecureChannel *channel, UA_UInt32 requestId,
15432  const UA_ByteString *msg, size_t offset,
15433  size_t chunklength) {
15434  /* Check if the chunk fits into the message */
15435  if(msg->length - offset < chunklength) {
15436  /* can't process all chunks for that request */
15437  UA_SecureChannel_removeChunk(channel, requestId);
15438  return;
15439  }
15440 
15441  /* Get the chunkentry */
15442  struct ChunkEntry *ch;
15443  LIST_FOREACH(ch, &channel->chunks, pointers) {
15444  if(ch->requestId == requestId)
15445  break;
15446  }
15447 
15448  /* No chunkentry on the channel, create one */
15449  if(!ch) {
15450  ch = UA_malloc(sizeof(struct ChunkEntry));
15451  if(!ch)
15452  return;
15453  ch->requestId = requestId;
15454  UA_ByteString_init(&ch->bytes);
15455  LIST_INSERT_HEAD(&channel->chunks, ch, pointers);
15456  }
15457 
15458  appendChunk(ch, msg, offset, chunklength);
15459 }
15460 
15461 static UA_ByteString
15462 UA_SecureChannel_finalizeChunk(UA_SecureChannel *channel, UA_UInt32 requestId,
15463  const UA_ByteString *msg, size_t offset,
15464  size_t chunklength, UA_Boolean *deleteChunk) {
15465  if(msg->length - offset < chunklength) {
15466  /* can't process all chunks for that request */
15467  UA_SecureChannel_removeChunk(channel, requestId);
15468  return UA_BYTESTRING_NULL;
15469  }
15470 
15471  struct ChunkEntry *ch;
15472  LIST_FOREACH(ch, &channel->chunks, pointers) {
15473  if(ch->requestId == requestId)
15474  break;
15475  }
15476 
15477  UA_ByteString bytes;
15478  if(!ch) {
15479  *deleteChunk = false;
15480  bytes.length = chunklength;
15481  bytes.data = msg->data + offset;
15482  } else {
15483  *deleteChunk = true;
15484  appendChunk(ch, msg, offset, chunklength);
15485  bytes = ch->bytes;
15486  LIST_REMOVE(ch, pointers);
15487  UA_free(ch);
15488  }
15489  return bytes;
15490 }
15491 
15492 static UA_StatusCode
15493 UA_SecureChannel_processSequenceNumber(UA_SecureChannel *channel, UA_UInt32 SequenceNumber) {
15494  /* Does the sequence number match? */
15495  if(SequenceNumber != channel->receiveSequenceNumber + 1) {
15496  if(channel->receiveSequenceNumber + 1 > 4294966271 && SequenceNumber < 1024)
15497  channel->receiveSequenceNumber = SequenceNumber - 1; /* Roll over */
15498  else
15500  }
15501  ++channel->receiveSequenceNumber;
15502  return UA_STATUSCODE_GOOD;
15503 }
15504 
15507  UA_ProcessMessageCallback callback, void *application) {
15509  size_t offset= 0;
15510  do {
15511 
15512  if (chunks->length > 3 && chunks->data[offset] == 'E' &&
15513  chunks->data[offset+1] == 'R' && chunks->data[offset+2] == 'R') {
15514  UA_TcpMessageHeader header;
15515  retval = UA_TcpMessageHeader_decodeBinary(chunks, &offset, &header);
15516  if(retval != UA_STATUSCODE_GOOD)
15517  break;
15518 
15519  UA_TcpErrorMessage errorMessage;
15520  retval = UA_TcpErrorMessage_decodeBinary(chunks, &offset, &errorMessage);
15521  if(retval != UA_STATUSCODE_GOOD)
15522  break;
15523 
15524  callback(application, channel, UA_MESSAGETYPE_ERR, 0, (void*)&errorMessage);
15525  continue;
15526  }
15527 
15528  /* Store the initial offset to compute the header length */
15529  size_t initial_offset = offset;
15530 
15531  /* Decode header */
15533  retval = UA_SecureConversationMessageHeader_decodeBinary(chunks, &offset, &header);
15534  if(retval != UA_STATUSCODE_GOOD)
15535  break;
15536 
15537  /* Is the channel attached to connection? */
15538  if(header.secureChannelId != channel->securityToken.channelId) {
15539  //Service_CloseSecureChannel(server, channel);
15540  //connection->close(connection);
15542  }
15543 
15544  /* Use requestId = 0 with OPN as argument for the callback */
15545  UA_SequenceHeader sequenceHeader;
15546  UA_SequenceHeader_init(&sequenceHeader);
15547 
15548  if((header.messageHeader.messageTypeAndChunkType & 0x00ffffff) != UA_MESSAGETYPE_OPN) {
15549  /* Check the symmetric security header (not for OPN) */
15550  UA_UInt32 tokenId = 0;
15551  retval |= UA_UInt32_decodeBinary(chunks, &offset, &tokenId);
15552  retval |= UA_SequenceHeader_decodeBinary(chunks, &offset, &sequenceHeader);
15553  if(retval != UA_STATUSCODE_GOOD)
15555 
15556  /* Does the token match? */
15557  if(tokenId != channel->securityToken.tokenId) {
15558  if(tokenId != channel->nextSecurityToken.tokenId)
15561  }
15562 
15563  /* Does the sequence number match? */
15564  retval = UA_SecureChannel_processSequenceNumber(channel, sequenceHeader.sequenceNumber);
15565  if(retval != UA_STATUSCODE_GOOD)
15567  }
15568 
15569  /* Process chunk */
15570  size_t processed_header = offset - initial_offset;
15571  switch(header.messageHeader.messageTypeAndChunkType & 0xff000000) {
15573  UA_SecureChannel_appendChunk(channel, sequenceHeader.requestId, chunks, offset,
15574  header.messageHeader.messageSize - processed_header);
15575  break;
15576  case UA_CHUNKTYPE_FINAL: {
15577  UA_Boolean realloced = false;
15578  UA_ByteString message =
15579  UA_SecureChannel_finalizeChunk(channel, sequenceHeader.requestId, chunks, offset,
15580  header.messageHeader.messageSize - processed_header,
15581  &realloced);
15582  if(message.length > 0) {
15583  callback(application, channel, header.messageHeader.messageTypeAndChunkType & 0x00ffffff,
15584  sequenceHeader.requestId, &message);
15585  if(realloced)
15586  UA_ByteString_deleteMembers(&message);
15587  }
15588  break; }
15589  case UA_CHUNKTYPE_ABORT:
15590  UA_SecureChannel_removeChunk(channel, sequenceHeader.requestId);
15591  break;
15592  default:
15594  }
15595 
15596  /* Jump to the end of the chunk */
15597  offset += (header.messageHeader.messageSize - processed_header);
15598  } while(chunks->length > offset);
15599 
15600  return retval;
15601 }
15602 
15603 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_session.c" ***********************************/
15604 
15605 /* This Source Code Form is subject to the terms of the Mozilla Public
15606 * License, v. 2.0. If a copy of the MPL was not distributed with this
15607 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15608 
15609 #ifdef UA_ENABLE_SUBSCRIPTIONS
15610 #endif
15611 
15612 UA_Session adminSession = {
15613  .clientDescription = {.applicationUri = {0, NULL}, .productUri = {0, NULL},
15614  .applicationName = {.locale = {0, NULL}, .text = {0, NULL}},
15615  .applicationType = UA_APPLICATIONTYPE_CLIENT,
15616  .gatewayServerUri = {0, NULL}, .discoveryProfileUri = {0, NULL},
15617  .discoveryUrlsSize = 0, .discoveryUrls = NULL},
15618  .sessionName = {sizeof("Administrator Session")-1, (UA_Byte*)"Administrator Session"},
15619  .authenticationToken = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15620  .identifier.numeric = 1},
15621  .sessionId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 1},
15622  .maxRequestMessageSize = UA_UINT32_MAX, .maxResponseMessageSize = UA_UINT32_MAX,
15623  .timeout = (UA_Double)UA_INT64_MAX, .validTill = UA_INT64_MAX, .channel = NULL,
15624  .continuationPoints = {NULL}};
15625 
15626 void UA_Session_init(UA_Session *session) {
15627  UA_ApplicationDescription_init(&session->clientDescription);
15628  session->activated = false;
15629  UA_NodeId_init(&session->authenticationToken);
15630  UA_NodeId_init(&session->sessionId);
15631  UA_String_init(&session->sessionName);
15632  session->maxRequestMessageSize = 0;
15633  session->maxResponseMessageSize = 0;
15634  session->timeout = 0;
15635  UA_DateTime_init(&session->validTill);
15636  session->channel = NULL;
15638  LIST_INIT(&session->continuationPoints);
15639 #ifdef UA_ENABLE_SUBSCRIPTIONS
15640  LIST_INIT(&session->serverSubscriptions);
15641  session->lastSubscriptionID = 0;
15642  SIMPLEQ_INIT(&session->responseQueue);
15643 #endif
15644 }
15645 
15646 void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server* server) {
15647  UA_ApplicationDescription_deleteMembers(&session->clientDescription);
15648  UA_NodeId_deleteMembers(&session->authenticationToken);
15649  UA_NodeId_deleteMembers(&session->sessionId);
15650  UA_String_deleteMembers(&session->sessionName);
15651  struct ContinuationPointEntry *cp, *temp;
15652  LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) {
15653  LIST_REMOVE(cp, pointers);
15654  UA_ByteString_deleteMembers(&cp->identifier);
15655  UA_BrowseDescription_deleteMembers(&cp->browseDescription);
15656  UA_free(cp);
15657  }
15658  if(session->channel)
15659  UA_SecureChannel_detachSession(session->channel, session);
15660 #ifdef UA_ENABLE_SUBSCRIPTIONS
15661  UA_Subscription *currents, *temps;
15662  LIST_FOREACH_SAFE(currents, &session->serverSubscriptions, listEntry, temps) {
15663  LIST_REMOVE(currents, listEntry);
15664  UA_Subscription_deleteMembers(currents, server);
15665  UA_free(currents);
15666  }
15667  UA_PublishResponseEntry *entry;
15668  while((entry = SIMPLEQ_FIRST(&session->responseQueue))) {
15669  SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry);
15670  UA_PublishResponse_deleteMembers(&entry->response);
15671  UA_free(entry);
15672  }
15673 #endif
15674 }
15675 
15676 void UA_Session_updateLifetime(UA_Session *session) {
15677  session->validTill = UA_DateTime_nowMonotonic() +
15678  (UA_DateTime)(session->timeout * UA_MSEC_TO_DATETIME);
15679 }
15680 
15681 #ifdef UA_ENABLE_SUBSCRIPTIONS
15682 
15683 void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription) {
15684  LIST_INSERT_HEAD(&session->serverSubscriptions, newSubscription, listEntry);
15685 }
15686 
15688 UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
15689  UA_UInt32 subscriptionID) {
15690  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, subscriptionID);
15691  if(!sub)
15693  LIST_REMOVE(sub, listEntry);
15694  UA_Subscription_deleteMembers(sub, server);
15695  UA_free(sub);
15696  return UA_STATUSCODE_GOOD;
15697 }
15698 
15700 UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID) {
15701  UA_Subscription *sub;
15702  LIST_FOREACH(sub, &session->serverSubscriptions, listEntry) {
15703  if(sub->subscriptionID == subscriptionID)
15704  break;
15705  }
15706  return sub;
15707 }
15708 
15709 UA_UInt32 UA_Session_getUniqueSubscriptionID(UA_Session *session) {
15710  return ++(session->lastSubscriptionID);
15711 }
15712 
15713 #endif
15714 
15715 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server.c" ***********************************/
15716 
15717 /* This Source Code Form is subject to the terms of the Mozilla Public
15718 * License, v. 2.0. If a copy of the MPL was not distributed with this
15719 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15720 
15721 
15722 #ifdef UA_ENABLE_GENERATE_NAMESPACE0
15723 #endif
15724 
15725 #ifdef UA_ENABLE_SUBSCRIPTIONS
15726 #endif
15727 
15728 #if defined(UA_ENABLE_MULTITHREADING) && !defined(NDEBUG)
15729 UA_THREAD_LOCAL bool rcu_locked = false;
15730 #endif
15731 
15732 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
15733 UA_THREAD_LOCAL UA_Session* methodCallSession = NULL;
15734 #endif
15735 
15736 static const UA_NodeId nodeIdHasSubType = {
15737  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15738  .identifier.numeric = UA_NS0ID_HASSUBTYPE};
15739 static const UA_NodeId nodeIdHasComponent = {
15740  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15741  .identifier.numeric = UA_NS0ID_HASCOMPONENT};
15742 static const UA_NodeId nodeIdHasProperty = {
15743  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15744  .identifier.numeric = UA_NS0ID_HASPROPERTY};
15745 static const UA_NodeId nodeIdOrganizes = {
15746  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15747  .identifier.numeric = UA_NS0ID_ORGANIZES};
15748 
15749 #ifndef UA_ENABLE_GENERATE_NAMESPACE0
15750 static const UA_NodeId nodeIdNonHierarchicalReferences = {
15751  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15752  .identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES};
15753 #endif
15754 
15755 /**********************/
15756 /* Namespace Handling */
15757 /**********************/
15758 
15759 UA_UInt16 addNamespace(UA_Server *server, const UA_String name) {
15760  /* Check if the namespace already exists in the server's namespace array */
15761  for(UA_UInt16 i=0;i<server->namespacesSize;++i) {
15762  if(UA_String_equal(&name, &server->namespaces[i]))
15763  return i;
15764  }
15765 
15766  /* Add a new namespace to the namsepace array */
15767  UA_String *newNS = UA_realloc(server->namespaces,
15768  sizeof(UA_String) * (server->namespacesSize + 1));
15769  if(!newNS)
15770  return 0;
15771  server->namespaces = newNS;
15772  UA_StatusCode retval = UA_String_copy(&name, &server->namespaces[server->namespacesSize]);
15773  if(retval != UA_STATUSCODE_GOOD)
15774  return 0;
15775  ++server->namespacesSize;
15776  return (UA_UInt16)(server->namespacesSize - 1);
15777 }
15778 
15779 UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
15780  /* Override const attribute to get string (dirty hack) */
15781  const UA_String nameString = {.length = strlen(name),
15782  .data = (UA_Byte*)(uintptr_t)name};
15783  return addNamespace(server, nameString);
15784 }
15785 
15786 
15788 UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId,
15789  UA_NodeIteratorCallback callback, void *handle) {
15790  UA_RCU_LOCK();
15791  const UA_Node *parent = UA_NodeStore_get(server->nodestore, &parentNodeId);
15792  if(!parent) {
15793  UA_RCU_UNLOCK();
15795  }
15796 
15797  /* TODO: We need to do an ugly copy of the references array since users may
15798  * delete references from within the callback. In single-threaded mode this
15799  * changes the same node we point at here. In multi-threaded mode, this
15800  * creates a new copy as nodes are truly immutable. */
15801  UA_ReferenceNode *refs = NULL;
15802  size_t refssize = parent->referencesSize;
15803  UA_StatusCode retval = UA_Array_copy(parent->references, parent->referencesSize,
15804  (void**)&refs, &UA_TYPES[UA_TYPES_REFERENCENODE]);
15805  if(retval != UA_STATUSCODE_GOOD) {
15806  UA_RCU_UNLOCK();
15807  return retval;
15808  }
15809 
15810  for(size_t i = parent->referencesSize; i > 0; --i) {
15811  UA_ReferenceNode *ref = &refs[i-1];
15812  retval |= callback(ref->targetId.nodeId, ref->isInverse,
15813  ref->referenceTypeId, handle);
15814  }
15815  UA_RCU_UNLOCK();
15816 
15817  UA_Array_delete(refs, refssize, &UA_TYPES[UA_TYPES_REFERENCENODE]);
15818  return retval;
15819 }
15820 
15821 static UA_AddNodesResult
15822 addNodeInternal(UA_Server *server, UA_Node *node, const UA_NodeId parentNodeId,
15823  const UA_NodeId referenceTypeId) {
15824  UA_AddNodesResult res;
15825  UA_AddNodesResult_init(&res);
15826  UA_RCU_LOCK();
15827  res.statusCode = Service_AddNodes_existing(server, &adminSession, node, &parentNodeId,
15828  &referenceTypeId, &UA_NODEID_NULL,
15829  NULL, &res.addedNodeId);
15830  UA_RCU_UNLOCK();
15831  return res;
15832 }
15833 
15834 static UA_AddNodesResult
15835 addNodeInternalWithType(UA_Server *server, UA_Node *node, const UA_NodeId parentNodeId,
15836  const UA_NodeId referenceTypeId, const UA_NodeId typeIdentifier) {
15837  UA_AddNodesResult res;
15838  UA_AddNodesResult_init(&res);
15839  UA_RCU_LOCK();
15840  res.statusCode = Service_AddNodes_existing(server, &adminSession, node, &parentNodeId,
15841  &referenceTypeId, &typeIdentifier,
15842  NULL, &res.addedNodeId);
15843  UA_RCU_UNLOCK();
15844  return res;
15845 }
15846 
15847 // delete any children of an instance without touching the object itself
15848 static void
15849 deleteInstanceChildren(UA_Server *server, UA_NodeId *objectNodeId) {
15850  /* Browse for children */
15851  UA_BrowseDescription bDes;
15852  UA_BrowseDescription_init(&bDes);
15853  bDes.nodeId = *objectNodeId;
15857  UA_BrowseResult bRes = UA_Server_browse(server, 0, &bDes);
15858 
15859  /* Delete Children */
15860  for(size_t i=0; i<bRes.referencesSize; ++i) {
15861  UA_ReferenceDescription *rd = &bRes.references[i];
15863  UA_Server_deleteNode(server, rd->nodeId.nodeId, true);
15864  } else if (rd->nodeClass == UA_NODECLASS_METHOD) {
15865  UA_Server_deleteReference(server, *objectNodeId, rd->referenceTypeId,
15866  true, rd->nodeId, true);
15867  }
15868  }
15869 
15870  UA_BrowseResult_deleteMembers(&bRes);
15871 }
15872 
15873 /**********/
15874 /* Server */
15875 /**********/
15876 
15877 /* The server needs to be stopped before it can be deleted */
15878 void UA_Server_delete(UA_Server *server) {
15879  // Delete the timed work
15881 
15882  // Delete all internal data
15885  UA_RCU_LOCK();
15886  UA_NodeStore_delete(server->nodestore);
15887  UA_RCU_UNLOCK();
15888  UA_Array_delete(server->namespaces, server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]);
15890  &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
15891 
15892 #ifdef UA_ENABLE_MULTITHREADING
15893  pthread_cond_destroy(&server->dispatchQueue_condition);
15894  pthread_mutex_destroy(&server->dispatchQueue_mutex);
15895 #endif
15896  UA_free(server);
15897 }
15898 
15899 /* Recurring cleanup. Removing unused and timed-out channels and sessions */
15900 static void UA_Server_cleanup(UA_Server *server, void *_) {
15901  UA_DateTime nowMonotonic = UA_DateTime_nowMonotonic();
15902  UA_SessionManager_cleanupTimedOut(&server->sessionManager, nowMonotonic);
15904 }
15905 
15906 static UA_StatusCode
15907 readStatus(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15908  const UA_NumericRange *range, UA_DataValue *value) {
15909  if(range) {
15910  value->hasStatus = true;
15912  return UA_STATUSCODE_GOOD;
15913  }
15914 
15915  UA_Server *server = (UA_Server*)handle;
15916  UA_ServerStatusDataType *retval = UA_ServerStatusDataType_new();
15917  retval->startTime = server->startTime;
15918  retval->currentTime = UA_DateTime_now();
15919  retval->state = UA_SERVERSTATE_RUNNING;
15920  retval->secondsTillShutdown = 0;
15921  UA_BuildInfo_copy(&server->config.buildInfo, &retval->buildInfo);
15922 
15923  value->value.type = &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE];
15924  value->value.arrayLength = 0;
15925  value->value.data = retval;
15926  value->value.arrayDimensionsSize = 0;
15927  value->value.arrayDimensions = NULL;
15928  value->hasValue = true;
15929  if(sourceTimeStamp) {
15930  value->hasSourceTimestamp = true;
15931  value->sourceTimestamp = UA_DateTime_now();
15932  }
15933  return UA_STATUSCODE_GOOD;
15934 }
15935 
15937 static UA_StatusCode
15938 readServiceLevel(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15939  const UA_NumericRange *range, UA_DataValue *value) {
15940  if(range) {
15941  value->hasStatus = true;
15943  return UA_STATUSCODE_GOOD;
15944  }
15945 
15946  value->value.type = &UA_TYPES[UA_TYPES_BYTE];
15947  value->value.arrayLength = 0;
15948  UA_Byte *byte = UA_Byte_new();
15949  *byte = 255;
15950  value->value.data = byte;
15951  value->value.arrayDimensionsSize = 0;
15952  value->value.arrayDimensions = NULL;
15953  value->hasValue = true;
15954  if(sourceTimeStamp) {
15955  value->hasSourceTimestamp = true;
15956  value->sourceTimestamp = UA_DateTime_now();
15957  }
15958  return UA_STATUSCODE_GOOD;
15959 }
15960 
15962 static UA_StatusCode
15963 readAuditing(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15964  const UA_NumericRange *range, UA_DataValue *value) {
15965  if(range) {
15966  value->hasStatus = true;
15968  return UA_STATUSCODE_GOOD;
15969  }
15970 
15971  value->value.type = &UA_TYPES[UA_TYPES_BOOLEAN];
15972  value->value.arrayLength = 0;
15973  UA_Boolean *boolean = UA_Boolean_new();
15974  *boolean = false;
15975  value->value.data = boolean;
15976  value->value.arrayDimensionsSize = 0;
15977  value->value.arrayDimensions = NULL;
15978  value->hasValue = true;
15979  if(sourceTimeStamp) {
15980  value->hasSourceTimestamp = true;
15981  value->sourceTimestamp = UA_DateTime_now();
15982  }
15983  return UA_STATUSCODE_GOOD;
15984 }
15985 
15986 static UA_StatusCode
15987 readNamespaces(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimestamp,
15988  const UA_NumericRange *range, UA_DataValue *value) {
15989  if(range) {
15990  value->hasStatus = true;
15992  return UA_STATUSCODE_GOOD;
15993  }
15994  UA_Server *server = (UA_Server*)handle;
15995  UA_StatusCode retval;
15996  retval = UA_Variant_setArrayCopy(&value->value, server->namespaces,
15997  server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]);
15998  if(retval != UA_STATUSCODE_GOOD)
15999  return retval;
16000  value->hasValue = true;
16001  if(sourceTimestamp) {
16002  value->hasSourceTimestamp = true;
16003  value->sourceTimestamp = UA_DateTime_now();
16004  }
16005  return UA_STATUSCODE_GOOD;
16006 }
16007 
16008 static UA_StatusCode
16009 writeNamespaces(void *handle, const UA_NodeId nodeid, const UA_Variant *data,
16010  const UA_NumericRange *range) {
16011  UA_Server *server = (UA_Server*)handle;
16012 
16013  /* Check the data type */
16014  if(data->type != &UA_TYPES[UA_TYPES_STRING])
16016 
16017  /* Check that the variant is not empty */
16018  if(!data->data)
16020 
16021  /* TODO: Writing with a range is not implemented */
16022  if(range)
16024 
16025  UA_String *newNamespaces = data->data;
16026  size_t newNamespacesSize = data->arrayLength;
16027 
16028  /* Test if we append to the existing namespaces */
16029  if(newNamespacesSize <= server->namespacesSize)
16031 
16032  /* Test if the existing namespaces are unchanged */
16033  for(size_t i = 0; i < server->namespacesSize; ++i) {
16034  if(!UA_String_equal(&server->namespaces[i], &newNamespaces[i]))
16036  }
16037 
16038  /* Add namespaces */
16039  for(size_t i = server->namespacesSize; i < newNamespacesSize; ++i)
16040  addNamespace(server, newNamespaces[i]);
16041  return UA_STATUSCODE_GOOD;
16042 }
16043 
16044 static UA_StatusCode
16045 readCurrentTime(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
16046  const UA_NumericRange *range, UA_DataValue *value) {
16047  if(range) {
16048  value->hasStatus = true;
16050  return UA_STATUSCODE_GOOD;
16051  }
16052  UA_DateTime currentTime = UA_DateTime_now();
16053  UA_StatusCode retval = UA_Variant_setScalarCopy(&value->value, &currentTime,
16054  &UA_TYPES[UA_TYPES_DATETIME]);
16055  if(retval != UA_STATUSCODE_GOOD)
16056  return retval;
16057  value->hasValue = true;
16058  if(sourceTimeStamp) {
16059  value->hasSourceTimestamp = true;
16060  value->sourceTimestamp = currentTime;
16061  }
16062  return UA_STATUSCODE_GOOD;
16063 }
16064 
16065 static void copyNames(UA_Node *node, char *name) {
16066  node->browseName = UA_QUALIFIEDNAME_ALLOC(0, name);
16067  node->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", name);
16068  node->description = UA_LOCALIZEDTEXT_ALLOC("en_US", name);
16069 }
16070 
16071 static void
16072 addDataTypeNode(UA_Server *server, char* name, UA_UInt32 datatypeid,
16073  UA_Boolean isAbstract, UA_UInt32 parent) {
16075  copyNames((UA_Node*)datatype, name);
16076  datatype->nodeId.identifier.numeric = datatypeid;
16077  datatype->isAbstract = isAbstract;
16078  addNodeInternal(server, (UA_Node*)datatype,
16079  UA_NODEID_NUMERIC(0, parent), nodeIdHasSubType);
16080 }
16081 
16082 static void
16083 addObjectTypeNode(UA_Server *server, char* name, UA_UInt32 objecttypeid,
16084  UA_UInt32 parent, UA_UInt32 parentreference) {
16086  copyNames((UA_Node*)objecttype, name);
16087  objecttype->nodeId.identifier.numeric = objecttypeid;
16088  addNodeInternal(server, (UA_Node*)objecttype, UA_NODEID_NUMERIC(0, parent),
16089  UA_NODEID_NUMERIC(0, parentreference));
16090 }
16091 
16092 static UA_VariableTypeNode*
16093 createVariableTypeNode(UA_Server *server, char* name, UA_UInt32 variabletypeid,
16094  UA_Boolean abstract) {
16096  copyNames((UA_Node*)variabletype, name);
16097  variabletype->nodeId.identifier.numeric = variabletypeid;
16098  variabletype->isAbstract = abstract;
16099  return variabletype;
16100 }
16101 
16102 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
16103 static UA_StatusCode
16104 GetMonitoredItems(void *handle, const UA_NodeId objectId, size_t inputSize,
16105  const UA_Variant *input, size_t outputSize, UA_Variant *output) {
16106  UA_UInt32 subscriptionId = *((UA_UInt32*)(input[0].data));
16107  UA_Session* session = methodCallSession;
16108  UA_Subscription* subscription = UA_Session_getSubscriptionByID(session, subscriptionId);
16109  if(!subscription)
16111 
16112  UA_UInt32 sizeOfOutput = 0;
16113  UA_MonitoredItem* monitoredItem;
16114  LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
16115  ++sizeOfOutput;
16116  }
16117  if(sizeOfOutput==0)
16118  return UA_STATUSCODE_GOOD;
16119 
16120  UA_UInt32* clientHandles = UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16121  UA_UInt32* serverHandles = UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16122  UA_UInt32 i = 0;
16123  LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
16124  clientHandles[i] = monitoredItem->clientHandle;
16125  serverHandles[i] = monitoredItem->itemId;
16126  ++i;
16127  }
16128  UA_Variant_setArray(&output[0], clientHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16129  UA_Variant_setArray(&output[1], serverHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16130  return UA_STATUSCODE_GOOD;
16131 }
16132 #endif
16133 
16134 UA_Server * UA_Server_new(const UA_ServerConfig config) {
16135  UA_Server *server = UA_calloc(1, sizeof(UA_Server));
16136  if(!server)
16137  return NULL;
16138 
16139  server->config = config;
16140  server->nodestore = UA_NodeStore_new();
16141  LIST_INIT(&server->repeatedJobs);
16142 
16143 #ifdef UA_ENABLE_MULTITHREADING
16144  rcu_init();
16145  cds_wfcq_init(&server->dispatchQueue_head, &server->dispatchQueue_tail);
16146  cds_lfs_init(&server->mainLoopJobs);
16147 #else
16148  SLIST_INIT(&server->delayedCallbacks);
16149 #endif
16150 
16151 #ifndef UA_ENABLE_DETERMINISTIC_RNG
16153 #endif
16154 
16155  /* ns0 and ns1 */
16156  server->namespaces = UA_Array_new(2, &UA_TYPES[UA_TYPES_STRING]);
16157  server->namespaces[0] = UA_STRING_ALLOC("http://opcfoundation.org/UA/");
16158  UA_String_copy(&server->config.applicationDescription.applicationUri, &server->namespaces[1]);
16159  server->namespacesSize = 2;
16160 
16161  /* Create endpoints w/o endpointurl. It is added from the networklayers at startup */
16162  server->endpointDescriptions = UA_Array_new(server->config.networkLayersSize,
16163  &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
16164  server->endpointDescriptionsSize = server->config.networkLayersSize;
16165  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
16166  UA_EndpointDescription *endpoint = &server->endpointDescriptions[i];
16168  endpoint->securityPolicyUri =
16169  UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None");
16170  endpoint->transportProfileUri =
16171  UA_STRING_ALLOC("http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary");
16172 
16173  size_t policies = 0;
16174  if(server->config.enableAnonymousLogin)
16175  ++policies;
16176  if(server->config.enableUsernamePasswordLogin)
16177  ++policies;
16178  endpoint->userIdentityTokensSize = policies;
16179  endpoint->userIdentityTokens = UA_Array_new(policies, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
16180 
16181  size_t currentIndex = 0;
16182  if(server->config.enableAnonymousLogin) {
16183  UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
16184  endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_ANONYMOUS;
16185  endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(ANONYMOUS_POLICY);
16186  ++currentIndex;
16187  }
16188  if(server->config.enableUsernamePasswordLogin) {
16189  UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
16190  endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_USERNAME;
16191  endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(USERNAME_POLICY);
16192  }
16193 
16194  /* The standard says "the HostName specified in the Server Certificate is the
16195  same as the HostName contained in the endpointUrl provided in the
16196  EndpointDescription */
16197  UA_String_copy(&server->config.serverCertificate, &endpoint->serverCertificate);
16198  UA_ApplicationDescription_copy(&server->config.applicationDescription, &endpoint->server);
16199 
16200  /* copy the discovery url only once the networlayer has been started */
16201  // UA_String_copy(&server->config.networkLayers[i].discoveryUrl, &endpoint->endpointUrl);
16202  }
16203 
16205  UA_SessionManager_init(&server->sessionManager, server);
16206 
16207  UA_Job cleanup = {.type = UA_JOBTYPE_METHODCALL,
16208  .job.methodCall = {.method = UA_Server_cleanup, .data = NULL} };
16209  UA_Server_addRepeatedJob(server, cleanup, 10000, NULL);
16210 
16211  server->startTime = UA_DateTime_now();
16212 
16213 #ifndef UA_ENABLE_GENERATE_NAMESPACE0
16214 
16215  /*********************************/
16216  /* Bootstrap reference hierarchy */
16217  /*********************************/
16218 
16220  copyNames((UA_Node*)references, "References");
16221  references->nodeId.identifier.numeric = UA_NS0ID_REFERENCES;
16222  references->isAbstract = true;
16223  references->symmetric = true;
16224  references->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "References");
16225 
16227  copyNames((UA_Node*)hassubtype, "HasSubtype");
16228  hassubtype->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "HasSupertype");
16229  hassubtype->nodeId.identifier.numeric = UA_NS0ID_HASSUBTYPE;
16230  hassubtype->isAbstract = false;
16231  hassubtype->symmetric = false;
16232 
16233  UA_RCU_LOCK();
16234  UA_NodeStore_insert(server->nodestore, (UA_Node*)references);
16235  UA_NodeStore_insert(server->nodestore, (UA_Node*)hassubtype);
16236  UA_RCU_UNLOCK();
16237 
16238  UA_ReferenceTypeNode *hierarchicalreferences = UA_NodeStore_newReferenceTypeNode();
16239  copyNames((UA_Node*)hierarchicalreferences, "HierarchicalReferences");
16240  hierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_HIERARCHICALREFERENCES;
16241  hierarchicalreferences->isAbstract = true;
16242  hierarchicalreferences->symmetric = false;
16243  addNodeInternal(server, (UA_Node*)hierarchicalreferences,
16244  UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCES), nodeIdHasSubType);
16245 
16246  UA_ReferenceTypeNode *nonhierarchicalreferences = UA_NodeStore_newReferenceTypeNode();
16247  copyNames((UA_Node*)nonhierarchicalreferences, "NonHierarchicalReferences");
16248  nonhierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES;
16249  nonhierarchicalreferences->isAbstract = true;
16250  nonhierarchicalreferences->symmetric = false;
16251  addNodeInternal(server, (UA_Node*)nonhierarchicalreferences,
16252  UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCES), nodeIdHasSubType);
16253 
16255  copyNames((UA_Node*)haschild, "HasChild");
16256  haschild->nodeId.identifier.numeric = UA_NS0ID_HASCHILD;
16257  haschild->isAbstract = false;
16258  haschild->symmetric = false;
16259  addNodeInternal(server, (UA_Node*)haschild,
16260  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16261 
16263  copyNames((UA_Node*)organizes, "Organizes");
16264  organizes->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OrganizedBy");
16265  organizes->nodeId.identifier.numeric = UA_NS0ID_ORGANIZES;
16266  organizes->isAbstract = false;
16267  organizes->symmetric = false;
16268  addNodeInternal(server, (UA_Node*)organizes,
16269  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16270 
16272  copyNames((UA_Node*)haseventsource, "HasEventSource");
16273  haseventsource->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "EventSourceOf");
16274  haseventsource->nodeId.identifier.numeric = UA_NS0ID_HASEVENTSOURCE;
16275  haseventsource->isAbstract = false;
16276  haseventsource->symmetric = false;
16277  addNodeInternal(server, (UA_Node*)haseventsource,
16278  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16279 
16281  copyNames((UA_Node*)hasmodellingrule, "HasModellingRule");
16282  hasmodellingrule->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ModellingRuleOf");
16283  hasmodellingrule->nodeId.identifier.numeric = UA_NS0ID_HASMODELLINGRULE;
16284  hasmodellingrule->isAbstract = false;
16285  hasmodellingrule->symmetric = false;
16286  addNodeInternal(server, (UA_Node*)hasmodellingrule, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16287 
16289  copyNames((UA_Node*)hasencoding, "HasEncoding");
16290  hasencoding->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "EncodingOf");
16291  hasencoding->nodeId.identifier.numeric = UA_NS0ID_HASENCODING;
16292  hasencoding->isAbstract = false;
16293  hasencoding->symmetric = false;
16294  addNodeInternal(server, (UA_Node*)hasencoding, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16295 
16297  copyNames((UA_Node*)hasdescription, "HasDescription");
16298  hasdescription->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "DescriptionOf");
16299  hasdescription->nodeId.identifier.numeric = UA_NS0ID_HASDESCRIPTION;
16300  hasdescription->isAbstract = false;
16301  hasdescription->symmetric = false;
16302  addNodeInternal(server, (UA_Node*)hasdescription, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16303 
16305  copyNames((UA_Node*)hastypedefinition, "HasTypeDefinition");
16306  hastypedefinition->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "TypeDefinitionOf");
16307  hastypedefinition->nodeId.identifier.numeric = UA_NS0ID_HASTYPEDEFINITION;
16308  hastypedefinition->isAbstract = false;
16309  hastypedefinition->symmetric = false;
16310  addNodeInternal(server, (UA_Node*)hastypedefinition, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16311 
16313  copyNames((UA_Node*)generatesevent, "GeneratesEvent");
16314  generatesevent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "GeneratedBy");
16315  generatesevent->nodeId.identifier.numeric = UA_NS0ID_GENERATESEVENT;
16316  generatesevent->isAbstract = false;
16317  generatesevent->symmetric = false;
16318  addNodeInternal(server, (UA_Node*)generatesevent, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16319 
16321  copyNames((UA_Node*)aggregates, "Aggregates");
16322  aggregates->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "AggregatedBy");
16323  aggregates->nodeId.identifier.numeric = UA_NS0ID_AGGREGATES;
16324  aggregates->isAbstract = false;
16325  aggregates->symmetric = false;
16326  addNodeInternal(server, (UA_Node*)aggregates, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCHILD), nodeIdHasSubType);
16327 
16328  /* complete bootstrap of hassubtype */
16329  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCHILD), nodeIdHasSubType,
16330  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE), true);
16331 
16333  copyNames((UA_Node*)hasproperty, "HasProperty");
16334  hasproperty->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "PropertyOf");
16335  hasproperty->nodeId.identifier.numeric = UA_NS0ID_HASPROPERTY;
16336  hasproperty->isAbstract = false;
16337  hasproperty->symmetric = false;
16338  addNodeInternal(server, (UA_Node*)hasproperty,
16339  UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16340 
16342  copyNames((UA_Node*)hascomponent, "HasComponent");
16343  hascomponent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ComponentOf");
16344  hascomponent->nodeId.identifier.numeric = UA_NS0ID_HASCOMPONENT;
16345  hascomponent->isAbstract = false;
16346  hascomponent->symmetric = false;
16347  addNodeInternal(server, (UA_Node*)hascomponent, UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16348 
16350  copyNames((UA_Node*)hasnotifier, "HasNotifier");
16351  hasnotifier->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "NotifierOf");
16352  hasnotifier->nodeId.identifier.numeric = UA_NS0ID_HASNOTIFIER;
16353  hasnotifier->isAbstract = false;
16354  hasnotifier->symmetric = false;
16355  addNodeInternal(server, (UA_Node*)hasnotifier, UA_NODEID_NUMERIC(0, UA_NS0ID_HASEVENTSOURCE), nodeIdHasSubType);
16356 
16358  copyNames((UA_Node*)hasorderedcomponent, "HasOrderedComponent");
16359  hasorderedcomponent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OrderedComponentOf");
16360  hasorderedcomponent->nodeId.identifier.numeric = UA_NS0ID_HASORDEREDCOMPONENT;
16361  hasorderedcomponent->isAbstract = false;
16362  hasorderedcomponent->symmetric = false;
16363  addNodeInternal(server, (UA_Node*)hasorderedcomponent, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT), nodeIdHasSubType);
16364 
16366  copyNames((UA_Node*)hasmodelparent, "HasModelParent");
16367  hasmodelparent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ModelParentOf");
16368  hasmodelparent->nodeId.identifier.numeric = UA_NS0ID_HASMODELPARENT;
16369  hasmodelparent->isAbstract = false;
16370  hasmodelparent->symmetric = false;
16371  addNodeInternal(server, (UA_Node*)hasmodelparent, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16372 
16374  copyNames((UA_Node*)fromstate, "FromState");
16375  fromstate->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ToTransition");
16376  fromstate->nodeId.identifier.numeric = UA_NS0ID_FROMSTATE;
16377  fromstate->isAbstract = false;
16378  fromstate->symmetric = false;
16379  addNodeInternal(server, (UA_Node*)fromstate, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16380 
16382  copyNames((UA_Node*)tostate, "ToState");
16383  tostate->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "FromTransition");
16384  tostate->nodeId.identifier.numeric = UA_NS0ID_TOSTATE;
16385  tostate->isAbstract = false;
16386  tostate->symmetric = false;
16387  addNodeInternal(server, (UA_Node*)tostate, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16388 
16390  copyNames((UA_Node*)hascause, "HasCause");
16391  hascause->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "MayBeCausedBy");
16392  hascause->nodeId.identifier.numeric = UA_NS0ID_HASCAUSE;
16393  hascause->isAbstract = false;
16394  hascause->symmetric = false;
16395  addNodeInternal(server, (UA_Node*)hascause, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16396 
16398  copyNames((UA_Node*)haseffect, "HasEffect");
16399  haseffect->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "MayBeEffectedBy");
16400  haseffect->nodeId.identifier.numeric = UA_NS0ID_HASEFFECT;
16401  haseffect->isAbstract = false;
16402  haseffect->symmetric = false;
16403  addNodeInternal(server, (UA_Node*)haseffect, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16404 
16405  UA_ReferenceTypeNode *hashistoricalconfiguration = UA_NodeStore_newReferenceTypeNode();
16406  copyNames((UA_Node*)hashistoricalconfiguration, "HasHistoricalConfiguration");
16407  hashistoricalconfiguration->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "HistoricalConfigurationOf");
16408  hashistoricalconfiguration->nodeId.identifier.numeric = UA_NS0ID_HASHISTORICALCONFIGURATION;
16409  hashistoricalconfiguration->isAbstract = false;
16410  hashistoricalconfiguration->symmetric = false;
16411  addNodeInternal(server, (UA_Node*)hashistoricalconfiguration, UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16412 
16413  /**************/
16414  /* Data Types */
16415  /**************/
16416 
16418  copyNames((UA_Node*)basedatatype, "BaseDataType");
16419  basedatatype->nodeId.identifier.numeric = UA_NS0ID_BASEDATATYPE;
16420  basedatatype->isAbstract = true;
16421  UA_RCU_LOCK();
16422  UA_NodeStore_insert(server->nodestore, (UA_Node*)basedatatype);
16423  UA_RCU_UNLOCK();
16424 
16425  addDataTypeNode(server, "Boolean", UA_NS0ID_BOOLEAN, false, UA_NS0ID_BASEDATATYPE);
16426  addDataTypeNode(server, "Number", UA_NS0ID_NUMBER, true, UA_NS0ID_BASEDATATYPE);
16427  addDataTypeNode(server, "Float", UA_NS0ID_FLOAT, false, UA_NS0ID_NUMBER);
16428  addDataTypeNode(server, "Double", UA_NS0ID_DOUBLE, false, UA_NS0ID_NUMBER);
16429  addDataTypeNode(server, "Integer", UA_NS0ID_INTEGER, true, UA_NS0ID_NUMBER);
16430  addDataTypeNode(server, "SByte", UA_NS0ID_SBYTE, false, UA_NS0ID_INTEGER);
16431  addDataTypeNode(server, "Int16", UA_NS0ID_INT16, false, UA_NS0ID_INTEGER);
16432  addDataTypeNode(server, "Int32", UA_NS0ID_INT32, false, UA_NS0ID_INTEGER);
16433  addDataTypeNode(server, "Int64", UA_NS0ID_INT64, false, UA_NS0ID_INTEGER);
16434  addDataTypeNode(server, "UInteger", UA_NS0ID_UINTEGER, true, UA_NS0ID_INTEGER);
16435  addDataTypeNode(server, "Byte", UA_NS0ID_BYTE, false, UA_NS0ID_UINTEGER);
16436  addDataTypeNode(server, "UInt16", UA_NS0ID_UINT16, false, UA_NS0ID_UINTEGER);
16437  addDataTypeNode(server, "UInt32", UA_NS0ID_UINT32, false, UA_NS0ID_UINTEGER);
16438  addDataTypeNode(server, "UInt64", UA_NS0ID_UINT64, false, UA_NS0ID_UINTEGER);
16439  addDataTypeNode(server, "String", UA_NS0ID_STRING, false, UA_NS0ID_BASEDATATYPE);
16440  addDataTypeNode(server, "DateTime", UA_NS0ID_DATETIME, false, UA_NS0ID_BASEDATATYPE);
16441  addDataTypeNode(server, "Guid", UA_NS0ID_GUID, false, UA_NS0ID_BASEDATATYPE);
16442  addDataTypeNode(server, "ByteString", UA_NS0ID_BYTESTRING, false, UA_NS0ID_BASEDATATYPE);
16443  addDataTypeNode(server, "XmlElement", UA_NS0ID_XMLELEMENT, false, UA_NS0ID_BASEDATATYPE);
16444  addDataTypeNode(server, "NodeId", UA_NS0ID_NODEID, false, UA_NS0ID_BASEDATATYPE);
16445  addDataTypeNode(server, "ExpandedNodeId", UA_NS0ID_EXPANDEDNODEID, false, UA_NS0ID_BASEDATATYPE);
16446  addDataTypeNode(server, "StatusCode", UA_NS0ID_STATUSCODE, false, UA_NS0ID_BASEDATATYPE);
16447  addDataTypeNode(server, "QualifiedName", UA_NS0ID_QUALIFIEDNAME, false, UA_NS0ID_BASEDATATYPE);
16448  addDataTypeNode(server, "LocalizedText", UA_NS0ID_LOCALIZEDTEXT, false, UA_NS0ID_BASEDATATYPE);
16449  addDataTypeNode(server, "Structure", UA_NS0ID_STRUCTURE, true, UA_NS0ID_BASEDATATYPE);
16450  addDataTypeNode(server, "ServerStatusDataType", UA_NS0ID_SERVERSTATUSDATATYPE, false, UA_NS0ID_STRUCTURE);
16451  addDataTypeNode(server, "BuildInfo", UA_NS0ID_BUILDINFO, false, UA_NS0ID_STRUCTURE);
16452  addDataTypeNode(server, "DataValue", UA_NS0ID_DATAVALUE, false, UA_NS0ID_BASEDATATYPE);
16453  addDataTypeNode(server, "DiagnosticInfo", UA_NS0ID_DIAGNOSTICINFO, false, UA_NS0ID_BASEDATATYPE);
16454  addDataTypeNode(server, "Enumeration", UA_NS0ID_ENUMERATION, true, UA_NS0ID_BASEDATATYPE);
16455  addDataTypeNode(server, "ServerState", UA_NS0ID_SERVERSTATE, false, UA_NS0ID_ENUMERATION);
16456 
16457  /*****************/
16458  /* VariableTypes */
16459  /*****************/
16460 
16461  UA_VariableTypeNode *basevartype =
16462  createVariableTypeNode(server, "BaseVariableType", UA_NS0ID_BASEVARIABLETYPE, true);
16463  basevartype->valueRank = -2;
16464  basevartype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16465  UA_RCU_LOCK();
16466  UA_NodeStore_insert(server->nodestore, (UA_Node*)basevartype);
16467  UA_RCU_UNLOCK();
16468 
16469  UA_VariableTypeNode *basedatavartype =
16470  createVariableTypeNode(server, "BaseDataVariableType", UA_NS0ID_BASEDATAVARIABLETYPE, false);
16471  basedatavartype->valueRank = -2;
16472  basedatavartype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16473  addNodeInternalWithType(server, (UA_Node*)basedatavartype,
16474  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE),
16475  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE));
16476 
16477  UA_VariableTypeNode *propertytype =
16478  createVariableTypeNode(server, "PropertyType", UA_NS0ID_PROPERTYTYPE, false);
16479  propertytype->valueRank = -2;
16480  propertytype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16481  addNodeInternalWithType(server, (UA_Node*)propertytype,
16482  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE),
16483  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE));
16484 
16485  UA_VariableTypeNode *buildinfotype =
16486  createVariableTypeNode(server, "BuildInfoType", UA_NS0ID_BUILDINFOTYPE, false);
16487  buildinfotype->valueRank = -1;
16488  buildinfotype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BUILDINFO);
16489  addNodeInternalWithType(server, (UA_Node*)buildinfotype,
16490  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
16491  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16492 
16493  UA_VariableTypeNode *serverstatustype =
16494  createVariableTypeNode(server, "ServerStatusType", UA_NS0ID_SERVERSTATUSTYPE, false);
16495  serverstatustype->valueRank = -1;
16496  serverstatustype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERSTATUSDATATYPE);
16497  addNodeInternalWithType(server, (UA_Node*)serverstatustype,
16498  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
16499  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16500 
16501  /**********************/
16502  /* Basic Object Types */
16503  /**********************/
16504 
16506  copyNames((UA_Node*)baseobjtype, "BaseObjectType");
16507  baseobjtype->nodeId.identifier.numeric = UA_NS0ID_BASEOBJECTTYPE;
16508  UA_RCU_LOCK();
16509  UA_NodeStore_insert(server->nodestore, (UA_Node*)baseobjtype);
16510  UA_RCU_UNLOCK();
16511 
16512  addObjectTypeNode(server, "ModellingRuleType", UA_NS0ID_MODELLINGRULETYPE,
16514  addObjectTypeNode(server, "FolderType", UA_NS0ID_FOLDERTYPE,
16516  addObjectTypeNode(server, "ServerType", UA_NS0ID_SERVERTYPE,
16518  addObjectTypeNode(server, "ServerDiagnosticsType", UA_NS0ID_SERVERDIAGNOSTICSTYPE,
16520  addObjectTypeNode(server, "ServerCapatilitiesType", UA_NS0ID_SERVERCAPABILITIESTYPE,
16522 
16523  /******************/
16524  /* Root and below */
16525  /******************/
16526 
16527  static const UA_NodeId nodeIdFolderType = {
16528  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
16529  .identifier.numeric = UA_NS0ID_FOLDERTYPE};
16530  static const UA_NodeId nodeIdHasTypeDefinition = {
16531  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
16532  .identifier.numeric = UA_NS0ID_HASTYPEDEFINITION};
16533 
16535  copyNames((UA_Node*)root, "Root");
16536  root->nodeId.identifier.numeric = UA_NS0ID_ROOTFOLDER;
16537  UA_RCU_LOCK();
16538  UA_NodeStore_insert(server->nodestore, (UA_Node*)root);
16539  UA_RCU_UNLOCK();
16540  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER), nodeIdHasTypeDefinition,
16541  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), true);
16542 
16544  copyNames((UA_Node*)objects, "Objects");
16545  objects->nodeId.identifier.numeric = UA_NS0ID_OBJECTSFOLDER;
16546  addNodeInternalWithType(server, (UA_Node*)objects, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16547  nodeIdOrganizes, nodeIdFolderType);
16548 
16550  copyNames((UA_Node*)types, "Types");
16551  types->nodeId.identifier.numeric = UA_NS0ID_TYPESFOLDER;
16552  addNodeInternalWithType(server, (UA_Node*)types, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16553  nodeIdOrganizes, nodeIdFolderType);
16554 
16555  UA_ObjectNode *referencetypes = UA_NodeStore_newObjectNode();
16556  copyNames((UA_Node*)referencetypes, "ReferenceTypes");
16557  referencetypes->nodeId.identifier.numeric = UA_NS0ID_REFERENCETYPESFOLDER;
16558  addNodeInternalWithType(server, (UA_Node*)referencetypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16559  nodeIdOrganizes, nodeIdFolderType);
16560  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCETYPESFOLDER), nodeIdOrganizes,
16561  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_REFERENCES), true);
16562 
16564  copyNames((UA_Node*)datatypes, "DataTypes");
16565  datatypes->nodeId.identifier.numeric = UA_NS0ID_DATATYPESFOLDER;
16566  addNodeInternalWithType(server, (UA_Node*)datatypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16567  nodeIdOrganizes, nodeIdFolderType);
16568  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_DATATYPESFOLDER), nodeIdOrganizes,
16569  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE), true);
16570 
16571  UA_ObjectNode *variabletypes = UA_NodeStore_newObjectNode();
16572  copyNames((UA_Node*)variabletypes, "VariableTypes");
16573  variabletypes->nodeId.identifier.numeric = UA_NS0ID_VARIABLETYPESFOLDER;
16574  addNodeInternalWithType(server, (UA_Node*)variabletypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16575  nodeIdOrganizes, nodeIdFolderType);
16576  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_VARIABLETYPESFOLDER), nodeIdOrganizes,
16577  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE), true);
16578 
16579  UA_ObjectNode *objecttypes = UA_NodeStore_newObjectNode();
16580  copyNames((UA_Node*)objecttypes, "ObjectTypes");
16581  objecttypes->nodeId.identifier.numeric = UA_NS0ID_OBJECTTYPESFOLDER;
16582  addNodeInternalWithType(server, (UA_Node*)objecttypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16583  nodeIdOrganizes, nodeIdFolderType);
16584  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTTYPESFOLDER), nodeIdOrganizes,
16585  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE), true);
16586 
16587  UA_ObjectNode *eventtypes = UA_NodeStore_newObjectNode();
16588  copyNames((UA_Node*)eventtypes, "EventTypes");
16589  eventtypes->nodeId.identifier.numeric = UA_NS0ID_EVENTTYPESFOLDER;
16590  addNodeInternalWithType(server, (UA_Node*)eventtypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16591  nodeIdOrganizes, nodeIdFolderType);
16592 
16594  copyNames((UA_Node*)views, "Views");
16595  views->nodeId.identifier.numeric = UA_NS0ID_VIEWSFOLDER;
16596  addNodeInternalWithType(server, (UA_Node*)views, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16597  nodeIdOrganizes, nodeIdFolderType);
16598 
16599  /*******************/
16600  /* Modelling Rules */
16601  /*******************/
16602 
16604  copyNames((UA_Node*)mandatory, "Mandatory");
16605  mandatory->nodeId.identifier.numeric = UA_NS0ID_MODELLINGRULE_MANDATORY;
16606  addNodeInternalWithType(server, (UA_Node*)mandatory, UA_NODEID_NULL,
16607  UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULETYPE));
16608 
16610  copyNames((UA_Node*)optional, "Optional");
16611  optional->nodeId.identifier.numeric = UA_NS0ID_MODELLINGRULE_OPTIONAL;
16612  addNodeInternalWithType(server, (UA_Node*)optional, UA_NODEID_NULL,
16613  UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULETYPE));
16614 
16615 #else
16616  /* load the generated namespace externally */
16617  ua_namespaceinit_generated(server);
16618 #endif
16619 
16620  /*********************/
16621  /* The Server Object */
16622  /*********************/
16623 
16624  /* Create our own server object */
16625  UA_ObjectNode *servernode = UA_NodeStore_newObjectNode();
16626  copyNames((UA_Node*)servernode, "Server");
16627  servernode->nodeId.identifier.numeric = UA_NS0ID_SERVER;
16628  addNodeInternalWithType(server, (UA_Node*)servernode, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
16629  nodeIdOrganizes, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERTYPE));
16630 
16631  // If we are in an UA conformant namespace, the above function just created a full ServerType object.
16632  // Before readding every variable, delete whatever got instantiated.
16633  // here we can't reuse servernode->nodeId because it may be deleted in addNodeInternalWithType if the node could not be added
16634  UA_NodeId serverNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER);
16635  deleteInstanceChildren(server, &serverNodeId);
16636 
16637  UA_VariableNode *namespaceArray = UA_NodeStore_newVariableNode();
16638  copyNames((UA_Node*)namespaceArray, "NamespaceArray");
16639  namespaceArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_NAMESPACEARRAY;
16640  namespaceArray->valueSource = UA_VALUESOURCE_DATASOURCE;
16641  namespaceArray->value.dataSource = (UA_DataSource) {.handle = server, .read = readNamespaces,
16642  .write = writeNamespaces};
16643  namespaceArray->dataType = UA_TYPES[UA_TYPES_STRING].typeId;
16644  namespaceArray->valueRank = 1;
16645  namespaceArray->minimumSamplingInterval = 1.0;
16646  addNodeInternalWithType(server, (UA_Node*)namespaceArray, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16647  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16648 
16649  UA_VariableNode *serverArray = UA_NodeStore_newVariableNode();
16650  copyNames((UA_Node*)serverArray, "ServerArray");
16651  serverArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERARRAY;
16652  UA_Variant_setArrayCopy(&serverArray->value.data.value.value,
16653  &server->config.applicationDescription.applicationUri, 1,
16654  &UA_TYPES[UA_TYPES_STRING]);
16655  serverArray->value.data.value.hasValue = true;
16656  serverArray->valueRank = 1;
16657  serverArray->minimumSamplingInterval = 1.0;
16658  addNodeInternalWithType(server, (UA_Node*)serverArray, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16659  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16660 
16661  UA_ObjectNode *servercapablities = UA_NodeStore_newObjectNode();
16662  copyNames((UA_Node*)servercapablities, "ServerCapabilities");
16663  servercapablities->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES;
16664  addNodeInternalWithType(server, (UA_Node*)servercapablities, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16665  nodeIdHasComponent,
16666  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERCAPABILITIESTYPE));
16667  UA_NodeId ServerCapabilitiesNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES);
16668  deleteInstanceChildren(server, &ServerCapabilitiesNodeId);
16669 
16670  UA_VariableNode *localeIdArray = UA_NodeStore_newVariableNode();
16671  copyNames((UA_Node*)localeIdArray, "LocaleIdArray");
16672  localeIdArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY;
16673  UA_String enLocale = UA_STRING("en");
16674  UA_Variant_setArrayCopy(&localeIdArray->value.data.value.value,
16675  &enLocale, 1, &UA_TYPES[UA_TYPES_STRING]);
16676  localeIdArray->value.data.value.hasValue = true;
16677  localeIdArray->valueRank = 1;
16678  localeIdArray->minimumSamplingInterval = 1.0;
16679  addNodeInternalWithType(server, (UA_Node*)localeIdArray,
16680  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16681  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16682 
16683  UA_VariableNode *maxBrowseContinuationPoints = UA_NodeStore_newVariableNode();
16684  copyNames((UA_Node*)maxBrowseContinuationPoints, "MaxBrowseContinuationPoints");
16685  maxBrowseContinuationPoints->nodeId.identifier.numeric =
16687  UA_Variant_setScalar(&maxBrowseContinuationPoints->value.data.value.value,
16688  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16689  maxBrowseContinuationPoints->value.data.value.hasValue = true;
16690  addNodeInternalWithType(server, (UA_Node*)maxBrowseContinuationPoints,
16691  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16692  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16693 
16695 #define MAX_PROFILEARRAY 16 //a *magic* limit to the number of supported profiles
16696 #define ADDPROFILEARRAY(x) profileArray[profileArraySize++] = UA_STRING_ALLOC(x)
16697  UA_String profileArray[MAX_PROFILEARRAY];
16698  UA_UInt16 profileArraySize = 0;
16699  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NanoEmbeddedDevice");
16700 
16701 #ifdef UA_ENABLE_SERVICESET_NODEMANAGEMENT
16702  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NodeManagement");
16703 #endif
16704 #ifdef UA_ENABLE_SERVICESET_METHOD
16705  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/Methods");
16706 #endif
16707 #ifdef UA_ENABLE_SUBSCRIPTIONS
16708  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription");
16709 #endif
16710 
16711  UA_VariableNode *serverProfileArray = UA_NodeStore_newVariableNode();
16712  copyNames((UA_Node*)serverProfileArray, "ServerProfileArray");
16713  serverProfileArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY;
16714  UA_Variant_setArray(&serverProfileArray->value.data.value.value,
16715  UA_Array_new(profileArraySize, &UA_TYPES[UA_TYPES_STRING]),
16716  profileArraySize, &UA_TYPES[UA_TYPES_STRING]);
16717  for(UA_UInt16 i=0;i<profileArraySize;++i)
16718  ((UA_String *)serverProfileArray->value.data.value.value.data)[i] = profileArray[i];
16719  serverProfileArray->value.data.value.hasValue = true;
16720  serverProfileArray->valueRank = 1;
16721  serverProfileArray->minimumSamplingInterval = 1.0;
16722  addNodeInternalWithType(server, (UA_Node*)serverProfileArray,
16723  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16724  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16725 
16726  UA_VariableNode *softwareCertificates = UA_NodeStore_newVariableNode();
16727  copyNames((UA_Node*)softwareCertificates, "SoftwareCertificates");
16728  softwareCertificates->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES;
16729  softwareCertificates->dataType = UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE].typeId;
16730  addNodeInternalWithType(server, (UA_Node*)softwareCertificates,
16731  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16732  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16733 
16734  UA_VariableNode *maxQueryContinuationPoints = UA_NodeStore_newVariableNode();
16735  copyNames((UA_Node*)maxQueryContinuationPoints, "MaxQueryContinuationPoints");
16736  maxQueryContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS;
16737  UA_Variant_setScalar(&maxQueryContinuationPoints->value.data.value.value,
16738  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16739  maxQueryContinuationPoints->value.data.value.hasValue = true;
16740  addNodeInternalWithType(server, (UA_Node*)maxQueryContinuationPoints,
16741  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16742  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16743 
16744  UA_VariableNode *maxHistoryContinuationPoints = UA_NodeStore_newVariableNode();
16745  copyNames((UA_Node*)maxHistoryContinuationPoints, "MaxHistoryContinuationPoints");
16746  maxHistoryContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS;
16747  UA_Variant_setScalar(&maxHistoryContinuationPoints->value.data.value.value,
16748  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16749  maxHistoryContinuationPoints->value.data.value.hasValue = true;
16750  addNodeInternalWithType(server, (UA_Node*)maxHistoryContinuationPoints,
16751  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16752  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16753 
16754  UA_VariableNode *minSupportedSampleRate = UA_NodeStore_newVariableNode();
16755  copyNames((UA_Node*)minSupportedSampleRate, "MinSupportedSampleRate");
16756  minSupportedSampleRate->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE;
16757  UA_Variant_setScalar(&minSupportedSampleRate->value.data.value.value,
16758  UA_Double_new(), &UA_TYPES[UA_TYPES_DOUBLE]);
16759  minSupportedSampleRate->value.data.value.hasValue = true;
16760  addNodeInternalWithType(server, (UA_Node*)minSupportedSampleRate,
16761  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16762  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16763 
16764  UA_ObjectNode *modellingRules = UA_NodeStore_newObjectNode();
16765  copyNames((UA_Node*)modellingRules, "ModellingRules");
16766  modellingRules->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES;
16767  addNodeInternalWithType(server, (UA_Node*)modellingRules,
16768  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES), nodeIdHasProperty,
16769  UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
16770 
16771  UA_ObjectNode *aggregateFunctions = UA_NodeStore_newObjectNode();
16772  copyNames((UA_Node*)aggregateFunctions, "AggregateFunctions");
16773  aggregateFunctions->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS;
16774  addNodeInternalWithType(server, (UA_Node*)aggregateFunctions,
16775  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16776  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
16777 
16778  UA_ObjectNode *serverdiagnostics = UA_NodeStore_newObjectNode();
16779  copyNames((UA_Node*)serverdiagnostics, "ServerDiagnostics");
16780  serverdiagnostics->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS;
16781  addNodeInternalWithType(server, (UA_Node*)serverdiagnostics,
16782  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16783  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERDIAGNOSTICSTYPE));
16784  UA_NodeId ServerDiagnosticsNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERDIAGNOSTICS);
16785  deleteInstanceChildren(server, &ServerDiagnosticsNodeId);
16786 
16787  UA_VariableNode *enabledFlag = UA_NodeStore_newVariableNode();
16788  copyNames((UA_Node*)enabledFlag, "EnabledFlag");
16789  enabledFlag->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG;
16790  UA_Variant_setScalar(&enabledFlag->value.data.value.value, UA_Boolean_new(),
16791  &UA_TYPES[UA_TYPES_BOOLEAN]);
16792  enabledFlag->value.data.value.hasValue = true;
16793  enabledFlag->valueRank = 1;
16794  enabledFlag->minimumSamplingInterval = 1.0;
16795  addNodeInternalWithType(server, (UA_Node*)enabledFlag,
16796  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERDIAGNOSTICS),
16797  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16798 
16799  UA_VariableNode *serverstatus = UA_NodeStore_newVariableNode();
16800  copyNames((UA_Node*)serverstatus, "ServerStatus");
16801  serverstatus->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS);
16802  serverstatus->valueSource = UA_VALUESOURCE_DATASOURCE;
16803  serverstatus->value.dataSource = (UA_DataSource) {.handle = server, .read = readStatus,
16804  .write = NULL};
16805  addNodeInternalWithType(server, (UA_Node*)serverstatus, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16806  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16807 
16808  UA_VariableNode *starttime = UA_NodeStore_newVariableNode();
16809  copyNames((UA_Node*)starttime, "StartTime");
16810  starttime->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME);
16811  UA_Variant_setScalarCopy(&starttime->value.data.value.value,
16812  &server->startTime, &UA_TYPES[UA_TYPES_DATETIME]);
16813  starttime->value.data.value.hasValue = true;
16814  addNodeInternalWithType(server, (UA_Node*)starttime,
16815  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16816  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16817 
16818  UA_VariableNode *currenttime = UA_NodeStore_newVariableNode();
16819  copyNames((UA_Node*)currenttime, "CurrentTime");
16820  currenttime->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME);
16821  currenttime->valueSource = UA_VALUESOURCE_DATASOURCE;
16822  currenttime->value.dataSource = (UA_DataSource) {.handle = NULL, .read = readCurrentTime,
16823  .write = NULL};
16824  addNodeInternalWithType(server, (UA_Node*)currenttime,
16825  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16826  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16827 
16828  UA_VariableNode *state = UA_NodeStore_newVariableNode();
16829  copyNames((UA_Node*)state, "State");
16830  state->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERSTATUS_STATE;
16831  UA_Variant_setScalar(&state->value.data.value.value, UA_ServerState_new(),
16832  &UA_TYPES[UA_TYPES_SERVERSTATE]);
16833  state->value.data.value.hasValue = true;
16834  state->minimumSamplingInterval = 500.0f;
16835  addNodeInternalWithType(server, (UA_Node*)state, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16836  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16837 
16838  UA_VariableNode *buildinfo = UA_NodeStore_newVariableNode();
16839  copyNames((UA_Node*)buildinfo, "BuildInfo");
16840  buildinfo->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO);
16841  UA_Variant_setScalarCopy(&buildinfo->value.data.value.value,
16842  &server->config.buildInfo, &UA_TYPES[UA_TYPES_BUILDINFO]);
16843  buildinfo->value.data.value.hasValue = true;
16844  addNodeInternalWithType(server, (UA_Node*)buildinfo,
16845  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16846  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BUILDINFOTYPE));
16847 
16848  UA_VariableNode *producturi = UA_NodeStore_newVariableNode();
16849  copyNames((UA_Node*)producturi, "ProductUri");
16850  producturi->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI);
16851  UA_Variant_setScalarCopy(&producturi->value.data.value.value, &server->config.buildInfo.productUri,
16852  &UA_TYPES[UA_TYPES_STRING]);
16853  producturi->value.data.value.hasValue = true;
16854  addNodeInternalWithType(server, (UA_Node*)producturi,
16855  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16856  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16857 
16858  UA_VariableNode *manufacturername = UA_NodeStore_newVariableNode();
16859  copyNames((UA_Node*)manufacturername, "ManufacturerName");
16860  manufacturername->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME);
16861  UA_Variant_setScalarCopy(&manufacturername->value.data.value.value,
16862  &server->config.buildInfo.manufacturerName,
16863  &UA_TYPES[UA_TYPES_STRING]);
16864  manufacturername->value.data.value.hasValue = true;
16865  addNodeInternalWithType(server, (UA_Node*)manufacturername,
16866  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16867  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16868 
16869  UA_VariableNode *productname = UA_NodeStore_newVariableNode();
16870  copyNames((UA_Node*)productname, "ProductName");
16871  productname->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME);
16872  UA_Variant_setScalarCopy(&productname->value.data.value.value, &server->config.buildInfo.productName,
16873  &UA_TYPES[UA_TYPES_STRING]);
16874  productname->value.data.value.hasValue = true;
16875  addNodeInternalWithType(server, (UA_Node*)productname,
16876  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16877  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16878 
16879  UA_VariableNode *softwareversion = UA_NodeStore_newVariableNode();
16880  copyNames((UA_Node*)softwareversion, "SoftwareVersion");
16881  softwareversion->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION);
16882  UA_Variant_setScalarCopy(&softwareversion->value.data.value.value,
16883  &server->config.buildInfo.softwareVersion, &UA_TYPES[UA_TYPES_STRING]);
16884  softwareversion->value.data.value.hasValue = true;
16885  addNodeInternalWithType(server, (UA_Node*)softwareversion,
16886  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16887  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16888 
16889  UA_VariableNode *buildnumber = UA_NodeStore_newVariableNode();
16890  copyNames((UA_Node*)buildnumber, "BuildNumber");
16891  buildnumber->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER);
16892  UA_Variant_setScalarCopy(&buildnumber->value.data.value.value, &server->config.buildInfo.buildNumber,
16893  &UA_TYPES[UA_TYPES_STRING]);
16894  buildnumber->value.data.value.hasValue = true;
16895  addNodeInternalWithType(server, (UA_Node*)buildnumber,
16896  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16897  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16898 
16899  UA_VariableNode *builddate = UA_NodeStore_newVariableNode();
16900  copyNames((UA_Node*)builddate, "BuildDate");
16901  builddate->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE);
16902  UA_Variant_setScalarCopy(&builddate->value.data.value.value, &server->config.buildInfo.buildDate,
16903  &UA_TYPES[UA_TYPES_DATETIME]);
16904  builddate->value.data.value.hasValue = true;
16905  addNodeInternalWithType(server, (UA_Node*)builddate,
16906  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16907  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16908 
16909  UA_VariableNode *secondstillshutdown = UA_NodeStore_newVariableNode();
16910  copyNames((UA_Node*)secondstillshutdown, "SecondsTillShutdown");
16911  secondstillshutdown->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN);
16912  UA_Variant_setScalar(&secondstillshutdown->value.data.value.value, UA_UInt32_new(),
16913  &UA_TYPES[UA_TYPES_UINT32]);
16914  secondstillshutdown->value.data.value.hasValue = true;
16915  addNodeInternalWithType(server, (UA_Node*)secondstillshutdown,
16916  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16917  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16918 
16919  UA_VariableNode *shutdownreason = UA_NodeStore_newVariableNode();
16920  copyNames((UA_Node*)shutdownreason, "ShutdownReason");
16921  shutdownreason->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON);
16922  UA_Variant_setScalar(&shutdownreason->value.data.value.value, UA_LocalizedText_new(),
16923  &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
16924  shutdownreason->value.data.value.hasValue = true;
16925  addNodeInternalWithType(server, (UA_Node*)shutdownreason,
16926  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16927  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16928 
16929  UA_VariableNode *servicelevel = UA_NodeStore_newVariableNode();
16930  copyNames((UA_Node*)servicelevel, "ServiceLevel");
16931  servicelevel->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVICELEVEL);
16932  servicelevel->valueSource = UA_VALUESOURCE_DATASOURCE;
16933  servicelevel->value.dataSource = (UA_DataSource) {.handle = server, .read = readServiceLevel,
16934  .write = NULL};
16935  addNodeInternalWithType(server, (UA_Node*)servicelevel,
16936  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasComponent,
16937  UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16938 
16939  UA_VariableNode *auditing = UA_NodeStore_newVariableNode();
16940  copyNames((UA_Node*)auditing, "Auditing");
16941  auditing->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_AUDITING);
16942  auditing->valueSource = UA_VALUESOURCE_DATASOURCE;
16943  auditing->value.dataSource = (UA_DataSource) {.handle = server, .read = readAuditing, .write = NULL};
16944  addNodeInternalWithType(server, (UA_Node*)auditing,
16945  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasComponent,
16946  UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16947 
16948  UA_ObjectNode *vendorServerInfo = UA_NodeStore_newObjectNode();
16949  copyNames((UA_Node*)vendorServerInfo, "VendorServerInfo");
16950  vendorServerInfo->nodeId.identifier.numeric = UA_NS0ID_SERVER_VENDORSERVERINFO;
16951  addNodeInternalWithType(server, (UA_Node*)vendorServerInfo,
16952  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasProperty,
16953  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE));
16954  /*
16955  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_VENDORSERVERINFO),
16956  nodeIdHasTypeDefinition, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_VENDORSERVERINFOTYPE), true);
16957  */
16958 
16959 
16960  UA_ObjectNode *serverRedundancy = UA_NodeStore_newObjectNode();
16961  copyNames((UA_Node*)serverRedundancy, "ServerRedundancy");
16962  serverRedundancy->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERREDUNDANCY;
16963  addNodeInternalWithType(server, (UA_Node*)serverRedundancy,
16964  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasProperty,
16965  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE));
16966  /*
16967  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY),
16968  nodeIdHasTypeDefinition, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_SERVERREDUNDANCYTYPE), true);
16969  */
16970 
16971  UA_VariableNode *redundancySupport = UA_NodeStore_newVariableNode();
16972  copyNames((UA_Node*)redundancySupport, "RedundancySupport");
16973  redundancySupport->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT);
16974  redundancySupport->valueRank = -1;
16975  redundancySupport->dataType = UA_TYPES[UA_TYPES_INT32].typeId;
16976  //FIXME: enum is needed for type letting it uninitialized for now
16977  UA_Variant_setScalar(&redundancySupport->value.data.value.value, UA_Int32_new(),
16978  &UA_TYPES[UA_TYPES_INT32]);
16979  redundancySupport->value.data.value.hasValue = true;
16980  addNodeInternalWithType(server, (UA_Node*)redundancySupport,
16981  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY),
16982  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16983 
16984 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
16985  UA_Argument inputArguments;
16986  UA_Argument_init(&inputArguments);
16987  inputArguments.dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16988  inputArguments.name = UA_STRING("SubscriptionId");
16989  inputArguments.valueRank = -1; /* scalar argument */
16990 
16991  UA_Argument outputArguments[2];
16992  UA_Argument_init(&outputArguments[0]);
16993  outputArguments[0].dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16994  outputArguments[0].name = UA_STRING("ServerHandles");
16995  outputArguments[0].valueRank = 1;
16996 
16997  UA_Argument_init(&outputArguments[1]);
16998  outputArguments[1].dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16999  outputArguments[1].name = UA_STRING("ClientHandles");
17000  outputArguments[1].valueRank = 1;
17001 
17002  UA_MethodAttributes addmethodattributes;
17003  UA_MethodAttributes_init(&addmethodattributes);
17004  addmethodattributes.displayName = UA_LOCALIZEDTEXT("", "GetMonitoredItems");
17005  addmethodattributes.executable = true;
17006  addmethodattributes.userExecutable = true;
17007 
17008  UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_GETMONITOREDITEMS),
17009  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
17010  UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
17011  UA_QUALIFIEDNAME(0, "GetMonitoredItems"), addmethodattributes,
17012  GetMonitoredItems, /* callback of the method node */
17013  NULL, /* handle passed with the callback */
17014  1, &inputArguments, 2, outputArguments, NULL);
17015 #endif
17016 
17017  return server;
17018 }
17019 
17020 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_binary.c" ***********************************/
17021 
17022 /* This Source Code Form is subject to the terms of the Mozilla Public
17023 * License, v. 2.0. If a copy of the MPL was not distributed with this
17024 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17025 
17026 
17027 /********************/
17028 /* Helper Functions */
17029 /********************/
17030 
17031 static void
17032 sendError(UA_SecureChannel *channel, const UA_ByteString *msg,
17033  size_t offset, const UA_DataType *responseType,
17034  UA_UInt32 requestId, UA_StatusCode error) {
17035  UA_RequestHeader requestHeader;
17036  UA_StatusCode retval = UA_RequestHeader_decodeBinary(msg, &offset, &requestHeader);
17037  if(retval != UA_STATUSCODE_GOOD)
17038  return;
17039  void *response = UA_alloca(responseType->memSize);
17040  UA_init(response, responseType);
17041  UA_ResponseHeader *responseHeader = (UA_ResponseHeader*)response;
17042  responseHeader->requestHandle = requestHeader.requestHandle;
17043  responseHeader->timestamp = UA_DateTime_now();
17044  responseHeader->serviceResult = error;
17045  UA_SecureChannel_sendBinaryMessage(channel, requestId, response, responseType);
17046  UA_RequestHeader_deleteMembers(&requestHeader);
17047  UA_ResponseHeader_deleteMembers(responseHeader);
17048 }
17049 
17050 static void
17051 getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
17052  const UA_DataType **responseType, UA_Service *service,
17053  UA_Boolean *requiresSession) {
17054  switch(requestTypeId) {
17056  *service = (UA_Service)Service_GetEndpoints;
17057  *requestType = &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST];
17058  *responseType = &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE];
17059  *requiresSession = false;
17060  break;
17062  *service = (UA_Service)Service_FindServers;
17063  *requestType = &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST];
17064  *responseType = &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE];
17065  *requiresSession = false;
17066  break;
17068  *service = (UA_Service)Service_CreateSession;
17069  *requestType = &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST];
17070  *responseType = &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE];
17071  *requiresSession = false;
17072  break;
17074  *service = (UA_Service)Service_ActivateSession;
17075  *requestType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST];
17076  *responseType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE];
17077  break;
17079  *service = (UA_Service)Service_CloseSession;
17080  *requestType = &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST];
17081  *responseType = &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE];
17082  break;
17084  *service = (UA_Service)Service_Read;
17085  *requestType = &UA_TYPES[UA_TYPES_READREQUEST];
17086  *responseType = &UA_TYPES[UA_TYPES_READRESPONSE];
17087  break;
17089  *service = (UA_Service)Service_Write;
17090  *requestType = &UA_TYPES[UA_TYPES_WRITEREQUEST];
17091  *responseType = &UA_TYPES[UA_TYPES_WRITERESPONSE];
17092  break;
17094  *service = (UA_Service)Service_Browse;
17095  *requestType = &UA_TYPES[UA_TYPES_BROWSEREQUEST];
17096  *responseType = &UA_TYPES[UA_TYPES_BROWSERESPONSE];
17097  break;
17099  *service = (UA_Service)Service_BrowseNext;
17100  *requestType = &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST];
17101  *responseType = &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE];
17102  break;
17104  *service = (UA_Service)Service_RegisterNodes;
17105  *requestType = &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST];
17106  *responseType = &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE];
17107  break;
17109  *service = (UA_Service)Service_UnregisterNodes;
17110  *requestType = &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST];
17111  *responseType = &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE];
17112  break;
17115  *requestType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST];
17116  *responseType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE];
17117  break;
17118 
17119 #ifdef UA_ENABLE_SUBSCRIPTIONS
17122  *requestType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST];
17123  *responseType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE];
17124  break;
17126  *requestType = &UA_TYPES[UA_TYPES_PUBLISHREQUEST];
17127  *responseType = &UA_TYPES[UA_TYPES_PUBLISHRESPONSE];
17128  break;
17130  *service = (UA_Service)Service_Republish;
17131  *requestType = &UA_TYPES[UA_TYPES_REPUBLISHREQUEST];
17132  *responseType = &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE];
17133  break;
17136  *requestType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST];
17137  *responseType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE];
17138  break;
17141  *requestType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST];
17142  *responseType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE];
17143  break;
17146  *requestType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST];
17147  *responseType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE];
17148  break;
17151  *requestType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST];
17152  *responseType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE];
17153  break;
17156  *requestType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST];
17157  *responseType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE];
17158  break;
17161  *requestType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST];
17162  *responseType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE];
17163  break;
17166  *requestType = &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST];
17167  *responseType = &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE];
17168  break;
17169 #endif
17170 
17171 #ifdef UA_ENABLE_METHODCALLS
17173  *service = (UA_Service)Service_Call;
17174  *requestType = &UA_TYPES[UA_TYPES_CALLREQUEST];
17175  *responseType = &UA_TYPES[UA_TYPES_CALLRESPONSE];
17176  break;
17177 #endif
17178 
17179 #ifdef UA_ENABLE_NODEMANAGEMENT
17181  *service = (UA_Service)Service_AddNodes;
17182  *requestType = &UA_TYPES[UA_TYPES_ADDNODESREQUEST];
17183  *responseType = &UA_TYPES[UA_TYPES_ADDNODESRESPONSE];
17184  break;
17186  *service = (UA_Service)Service_AddReferences;
17187  *requestType = &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST];
17188  *responseType = &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE];
17189  break;
17191  *service = (UA_Service)Service_DeleteNodes;
17192  *requestType = &UA_TYPES[UA_TYPES_DELETENODESREQUEST];
17193  *responseType = &UA_TYPES[UA_TYPES_DELETENODESRESPONSE];
17194  break;
17197  *requestType = &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST];
17198  *responseType = &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE];
17199  break;
17200 #endif
17201 
17202  default:
17203  break;
17204  }
17205 }
17206 
17207 /*************************/
17208 /* Process Message Types */
17209 /*************************/
17210 
17211 /* HEL -> Open up the connection */
17212 static void processHEL(UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
17213  UA_TcpHelloMessage helloMessage;
17214  if(UA_TcpHelloMessage_decodeBinary(msg, offset, &helloMessage) != UA_STATUSCODE_GOOD) {
17215  connection->close(connection);
17216  return;
17217  }
17218 
17219  /* Parameterize the connection */
17220  connection->remoteConf.maxChunkCount = helloMessage.maxChunkCount; /* zero -> unlimited */
17221  connection->remoteConf.maxMessageSize = helloMessage.maxMessageSize; /* zero -> unlimited */
17222  connection->remoteConf.protocolVersion = helloMessage.protocolVersion;
17223  connection->remoteConf.recvBufferSize = helloMessage.receiveBufferSize;
17224  if(connection->localConf.sendBufferSize > helloMessage.receiveBufferSize)
17225  connection->localConf.sendBufferSize = helloMessage.receiveBufferSize;
17226  connection->remoteConf.sendBufferSize = helloMessage.sendBufferSize;
17227  if(connection->localConf.recvBufferSize > helloMessage.sendBufferSize)
17228  connection->localConf.recvBufferSize = helloMessage.sendBufferSize;
17229  connection->state = UA_CONNECTION_ESTABLISHED;
17230  UA_TcpHelloMessage_deleteMembers(&helloMessage);
17231 
17232  /* Build acknowledge response */
17233  UA_TcpAcknowledgeMessage ackMessage;
17234  ackMessage.protocolVersion = connection->localConf.protocolVersion;
17235  ackMessage.receiveBufferSize = connection->localConf.recvBufferSize;
17236  ackMessage.sendBufferSize = connection->localConf.sendBufferSize;
17237  ackMessage.maxMessageSize = connection->localConf.maxMessageSize;
17238  ackMessage.maxChunkCount = connection->localConf.maxChunkCount;
17239 
17240  UA_TcpMessageHeader ackHeader;
17242  ackHeader.messageSize = 8 + 20; /* ackHeader + ackMessage */
17243 
17244  /* Get the send buffer from the network layer */
17245  UA_ByteString ack_msg;
17246  UA_ByteString_init(&ack_msg);
17247  UA_StatusCode retval =
17248  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &ack_msg);
17249  if(retval != UA_STATUSCODE_GOOD)
17250  return;
17251 
17252  /* Encode and send the response */
17253  size_t tmpPos = 0;
17254  UA_TcpMessageHeader_encodeBinary(&ackHeader, &ack_msg, &tmpPos);
17255  UA_TcpAcknowledgeMessage_encodeBinary(&ackMessage, &ack_msg, &tmpPos);
17256  ack_msg.length = ackHeader.messageSize;
17257  connection->send(connection, &ack_msg);
17258 }
17259 
17260 /* OPN -> Open up/renew the securechannel */
17261 static void
17262 processOPN(UA_Server *server, UA_Connection *connection,
17263  UA_UInt32 channelId, const UA_ByteString *msg) {
17265  /* Called before HEL */
17266  if(connection->state != UA_CONNECTION_ESTABLISHED)
17268  /* Opening up a channel with a channelid already set */
17269  if(!connection->channel && channelId != 0)
17271  /* Renew a channel with the wrong channelid */
17272  if(connection->channel && channelId != connection->channel->securityToken.channelId)
17274 
17275  /* Decode the request */
17277  UA_SequenceHeader seqHeader;
17278  UA_NodeId requestType;
17280  size_t offset = 0;
17281  retval |= UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(msg, &offset, &asymHeader);
17282  retval |= UA_SequenceHeader_decodeBinary(msg, &offset, &seqHeader);
17283  retval |= UA_NodeId_decodeBinary(msg, &offset, &requestType);
17284  retval |= UA_OpenSecureChannelRequest_decodeBinary(msg, &offset, &r);
17285 
17286  /* Error occured */
17287  if(retval != UA_STATUSCODE_GOOD || requestType.identifier.numeric != 446) {
17288  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17289  UA_NodeId_deleteMembers(&requestType);
17290  UA_OpenSecureChannelRequest_deleteMembers(&r);
17291  connection->close(connection);
17292  return;
17293  }
17294 
17295  /* Call the service */
17297  UA_OpenSecureChannelResponse_init(&p);
17298  Service_OpenSecureChannel(server, connection, &r, &p);
17299  UA_OpenSecureChannelRequest_deleteMembers(&r);
17300 
17301  /* Opening the channel failed */
17302  UA_SecureChannel *channel = connection->channel;
17303  if(!channel) {
17304  UA_OpenSecureChannelResponse_deleteMembers(&p);
17305  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17306  connection->close(connection);
17307  return;
17308  }
17309 
17310  /* Set the starting sequence number */
17311  channel->receiveSequenceNumber = seqHeader.sequenceNumber;
17312 
17313  /* Allocate the return message */
17314  UA_ByteString resp_msg;
17315  UA_ByteString_init(&resp_msg);
17316  retval = connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &resp_msg);
17317  if(retval != UA_STATUSCODE_GOOD) {
17318  UA_OpenSecureChannelResponse_deleteMembers(&p);
17319  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17320  connection->close(connection);
17321  return;
17322  }
17323 
17324  /* Encode the message after the secureconversationmessageheader */
17325  size_t tmpPos = 12; /* skip the header */
17326  seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1);
17327  retval |= UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(&asymHeader, &resp_msg, &tmpPos); // just mirror back
17328  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &resp_msg, &tmpPos);
17329  UA_NodeId responseType = UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE].binaryEncodingId);
17330  retval |= UA_NodeId_encodeBinary(&responseType, &resp_msg, &tmpPos);
17331  retval |= UA_OpenSecureChannelResponse_encodeBinary(&p, &resp_msg, &tmpPos);
17332 
17333  if(retval != UA_STATUSCODE_GOOD) {
17334  connection->releaseSendBuffer(connection, &resp_msg);
17335  UA_OpenSecureChannelResponse_deleteMembers(&p);
17336  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17337  connection->close(connection);
17338  return;
17339  }
17340 
17341  /* Encode the secureconversationmessageheader (cannot fail) and send */
17344  respHeader.messageHeader.messageSize = (UA_UInt32)tmpPos;
17345  respHeader.secureChannelId = p.securityToken.channelId;
17346  tmpPos = 0;
17347  UA_SecureConversationMessageHeader_encodeBinary(&respHeader, &resp_msg, &tmpPos);
17348  resp_msg.length = respHeader.messageHeader.messageSize;
17349  connection->send(connection, &resp_msg);
17350 
17351  /* Clean up */
17352  UA_OpenSecureChannelResponse_deleteMembers(&p);
17353  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17354 }
17355 
17356 static void
17357 processMSG(UA_Server *server, UA_SecureChannel *channel,
17358  UA_UInt32 requestId, const UA_ByteString *msg) {
17359  /* At 0, the nodeid starts... */
17360  size_t ppos = 0;
17361  size_t *offset = &ppos;
17362 
17363  /* Decode the nodeid */
17364  UA_NodeId requestTypeId;
17365  UA_StatusCode retval = UA_NodeId_decodeBinary(msg, offset, &requestTypeId);
17366  if(retval != UA_STATUSCODE_GOOD)
17367  return;
17368  if(requestTypeId.identifierType != UA_NODEIDTYPE_NUMERIC)
17369  UA_NodeId_deleteMembers(&requestTypeId); /* leads to badserviceunsupported */
17370 
17371  /* Store the start-position of the request */
17372  size_t requestPos = *offset;
17373 
17374  /* Get the service pointers */
17375  UA_Service service = NULL;
17376  const UA_DataType *requestType = NULL;
17377  const UA_DataType *responseType = NULL;
17378  UA_Boolean sessionRequired = true;
17379  getServicePointers(requestTypeId.identifier.numeric, &requestType,
17380  &responseType, &service, &sessionRequired);
17381  if(!requestType) {
17382  if(requestTypeId.identifier.numeric == 787) {
17383  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17384  "Client requested a subscription, " \
17385  "but those are not enabled in the build");
17386  } else {
17387  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17388  "Unknown request with type identifier %i",
17389  requestTypeId.identifier.numeric);
17390  }
17391  sendError(channel, msg, requestPos, &UA_TYPES[UA_TYPES_SERVICEFAULT],
17393  return;
17394  }
17395  UA_assert(responseType);
17396 
17397 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
17398  /* Stateless extension: Sessions are optional */
17399  sessionRequired = false;
17400 #endif
17401 
17402  /* Decode the request */
17403  void *request = UA_alloca(requestType->memSize);
17404  UA_RequestHeader *requestHeader = (UA_RequestHeader*)request;
17405  retval = UA_decodeBinary(msg, offset, request, requestType);
17406  if(retval != UA_STATUSCODE_GOOD) {
17407  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17408  "Could not decode the request");
17409  sendError(channel, msg, requestPos, responseType, requestId, retval);
17410  return;
17411  }
17412 
17413  /* Prepare the respone */
17414  void *response = UA_alloca(responseType->memSize);
17415  UA_init(response, responseType);
17416  UA_Session *session = NULL; /* must be initialized before goto send_response */
17417 
17418  /* CreateSession doesn't need a session */
17419  if(requestType == &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]) {
17420  Service_CreateSession(server, channel, request, response);
17421  goto send_response;
17422  }
17423 
17424  /* Find the matching session */
17425  session = UA_SecureChannel_getSession(channel, &requestHeader->authenticationToken);
17426  if(!session)
17427  session = UA_SessionManager_getSession(&server->sessionManager,
17428  &requestHeader->authenticationToken);
17429 
17430  if(requestType == &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]) {
17431  if(!session) {
17432  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17433  "Trying to activate a session that is " \
17434  "not known in the server");
17435  sendError(channel, msg, requestPos, responseType,
17437  UA_deleteMembers(request, requestType);
17438  return;
17439  }
17440  Service_ActivateSession(server, channel, session, request, response);
17441  goto send_response;
17442  }
17443 
17444  /* Set an anonymous, inactive session for services that need no session */
17445  UA_Session anonymousSession;
17446  if(!session) {
17447  if(sessionRequired) {
17448  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17449  "Service request %i without a valid session",
17450  requestType->binaryEncodingId);
17451  sendError(channel, msg, requestPos, responseType,
17453  UA_deleteMembers(request, requestType);
17454  return;
17455  }
17456  UA_Session_init(&anonymousSession);
17457  anonymousSession.sessionId = UA_NODEID_GUID(0, UA_GUID_NULL);
17458  anonymousSession.channel = channel;
17459  session = &anonymousSession;
17460  }
17461 
17462  /* Trying to use a non-activated session? */
17463  if(sessionRequired && !session->activated) {
17464  UA_LOG_INFO_SESSION(server->config.logger, session,
17465  "Calling service %i on a non-activated session",
17466  requestType->binaryEncodingId);
17467  sendError(channel, msg, requestPos, responseType,
17470  &session->authenticationToken);
17471  UA_deleteMembers(request, requestType);
17472  return;
17473  }
17474 
17475  /* The session is bound to another channel */
17476  if(session->channel != channel) {
17477  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17478  "Client tries to use an obsolete securechannel");
17479  sendError(channel, msg, requestPos, responseType,
17481  UA_deleteMembers(request, requestType);
17482  return;
17483  }
17484 
17485  /* Update the session lifetime */
17486  UA_Session_updateLifetime(session);
17487 
17488 #ifdef UA_ENABLE_SUBSCRIPTIONS
17489  /* The publish request is not answered immediately */
17490  if(requestType == &UA_TYPES[UA_TYPES_PUBLISHREQUEST]) {
17491  Service_Publish(server, session, request, requestId);
17492  UA_deleteMembers(request, requestType);
17493  return;
17494  }
17495 #endif
17496 
17497  /* Call the service */
17498  UA_assert(service); /* For all services besides publish, the service pointer is non-NULL*/
17499  service(server, session, request, response);
17500 
17501  send_response:
17502  /* Send the response */
17503  ((UA_ResponseHeader*)response)->requestHandle = requestHeader->requestHandle;
17504  ((UA_ResponseHeader*)response)->timestamp = UA_DateTime_now();
17505  retval = UA_SecureChannel_sendBinaryMessage(channel, requestId, response, responseType);
17506 
17507  if(retval != UA_STATUSCODE_GOOD)
17508  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17509  "Could not send the message over the SecureChannel "
17510  "with StatusCode %s", UA_StatusCode_name(retval));
17511 
17512  /* Clean up */
17513  UA_deleteMembers(request, requestType);
17514  UA_deleteMembers(response, responseType);
17515 }
17516 
17517 /* ERR -> Error from the remote connection */
17518 static void processERR(UA_Server *server, UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
17519  UA_TcpErrorMessage errorMessage;
17520  if (UA_TcpErrorMessage_decodeBinary(msg, offset, &errorMessage) != UA_STATUSCODE_GOOD) {
17521  connection->close(connection);
17522  return;
17523  }
17524 
17525  UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_NETWORK,
17526  "Client replied with an error message: %s %.*s",
17527  UA_StatusCode_name(errorMessage.error), errorMessage.reason.length, errorMessage.reason.data);
17528 }
17529 
17530 /* Takes decoded messages starting at the nodeid of the content type. Only OPN
17531  * messages start at the asymmetricalgorithmsecurityheader and are not
17532  * decoded. */
17533 static void
17534 UA_Server_processSecureChannelMessage(UA_Server *server, UA_SecureChannel *channel,
17535  UA_MessageType messagetype, UA_UInt32 requestId,
17536  const UA_ByteString *message) {
17537  UA_assert(channel);
17538  UA_assert(channel->connection);
17539  switch(messagetype) {
17540  case UA_MESSAGETYPE_ERR: {
17541  const UA_TcpErrorMessage *msg = (const UA_TcpErrorMessage *) message;
17542  UA_LOG_ERROR_CHANNEL(server->config.logger, channel,
17543  "Client replied with an error message: %s %.*s",
17544  UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
17545  break;
17546  }
17547  case UA_MESSAGETYPE_HEL:
17548  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17549  "Cannot process a HEL on an open channel");
17550  break;
17551  case UA_MESSAGETYPE_OPN:
17552  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17553  "Process an OPN on an open channel");
17554  processOPN(server, channel->connection, channel->securityToken.channelId, message);
17555  break;
17556  case UA_MESSAGETYPE_MSG:
17557  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17558  "Process a MSG", channel->connection->sockfd);
17559  processMSG(server, channel, requestId, message);
17560  break;
17561  case UA_MESSAGETYPE_CLO:
17562  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17563  "Process a CLO", channel->connection->sockfd);
17564  Service_CloseSecureChannel(server, channel);
17565  break;
17566  default:
17567  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17568  "Unknown message type");
17569  }
17570 }
17571 
17572 /* Takes the raw message from the network layer */
17573 void
17574 UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
17575  const UA_ByteString *message) {
17576  UA_SecureChannel *channel = connection->channel;
17577  if(channel) {
17578  /* Assemble chunks in the securechannel and process complete messages */
17579  UA_StatusCode retval =
17580  UA_SecureChannel_processChunks(channel, message,
17581  (UA_ProcessMessageCallback*)UA_Server_processSecureChannelMessage, server);
17582  if(retval != UA_STATUSCODE_GOOD)
17583  UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Procesing chunks "
17584  "resulted in error code %s", UA_StatusCode_name(retval));
17585  } else {
17586  /* Process messages without a channel and no chunking */
17587  size_t offset = 0;
17588  UA_TcpMessageHeader tcpMessageHeader;
17589  UA_StatusCode retval = UA_TcpMessageHeader_decodeBinary(message, &offset, &tcpMessageHeader);
17590  if(retval != UA_STATUSCODE_GOOD) {
17591  connection->close(connection);
17592  return;
17593  }
17594 
17595  /* Dispatch according to the message type */
17596  switch(tcpMessageHeader.messageTypeAndChunkType & 0x00ffffff) {
17597  case UA_MESSAGETYPE_ERR:
17598  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17599  "Connection %i | Process ERR message", connection->sockfd);
17600  processERR(server, connection, message, &offset);
17601  break;
17602  case UA_MESSAGETYPE_HEL:
17603  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17604  "Connection %i | Process HEL message", connection->sockfd);
17605  processHEL(connection, message, &offset);
17606  break;
17607  case UA_MESSAGETYPE_OPN: {
17608  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17609  "Connection %i | Process OPN message", connection->sockfd);
17610  UA_UInt32 channelId = 0;
17611  retval = UA_UInt32_decodeBinary(message, &offset, &channelId);
17612  if(retval != UA_STATUSCODE_GOOD)
17613  connection->close(connection);
17614  UA_ByteString offsetMessage = (UA_ByteString){
17615  .data = message->data + 12, .length = message->length - 12};
17616  processOPN(server, connection, channelId, &offsetMessage);
17617  break; }
17618  case UA_MESSAGETYPE_MSG:
17619  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17620  "Connection %i | Processing a MSG message not possible "
17621  "without a SecureChannel", connection->sockfd);
17622  connection->close(connection);
17623  break;
17624  case UA_MESSAGETYPE_CLO:
17625  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17626  "Connection %i | Processing a CLO message not possible "
17627  "without a SecureChannel", connection->sockfd);
17628  connection->close(connection);
17629  break;
17630  default:
17631  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17632  "Connection %i | Unknown message type", connection->sockfd);
17633  connection->close(connection);
17634  }
17635  }
17636 }
17637 
17638 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_utils.c" ***********************************/
17639 
17640 /* This Source Code Form is subject to the terms of the Mozilla Public
17641 * License, v. 2.0. If a copy of the MPL was not distributed with this
17642 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17643 
17644 
17645 /**********************/
17646 /* Parse NumericRange */
17647 /**********************/
17648 
17649 static size_t
17650 readDimension(UA_Byte *buf, size_t buflen, UA_NumericRangeDimension *dim) {
17651  size_t progress = UA_readNumber(buf, buflen, &dim->min);
17652  if(progress == 0)
17653  return 0;
17654  if(buflen <= progress + 1 || buf[progress] != ':') {
17655  dim->max = dim->min;
17656  return progress;
17657  }
17658 
17659  ++progress;
17660  size_t progress2 = UA_readNumber(&buf[progress], buflen - progress, &dim->max);
17661  if(progress2 == 0)
17662  return 0;
17663 
17664  /* invalid range */
17665  if(dim->min >= dim->max)
17666  return 0;
17667 
17668  return progress + progress2;
17669 }
17670 
17673  size_t idx = 0;
17674  size_t dimensionsMax = 0;
17675  UA_NumericRangeDimension *dimensions = NULL;
17677  size_t offset = 0;
17678  while(true) {
17679  /* alloc dimensions */
17680  if(idx >= dimensionsMax) {
17681  UA_NumericRangeDimension *newds;
17682  size_t newdssize = sizeof(UA_NumericRangeDimension) * (dimensionsMax + 2);
17683  newds = UA_realloc(dimensions, newdssize);
17684  if(!newds) {
17686  break;
17687  }
17688  dimensions = newds;
17689  dimensionsMax = dimensionsMax + 2;
17690  }
17691 
17692  /* read the dimension */
17693  size_t progress = readDimension(&str->data[offset], str->length - offset,
17694  &dimensions[idx]);
17695  if(progress == 0) {
17697  break;
17698  }
17699  offset += progress;
17700  ++idx;
17701 
17702  /* loop into the next dimension */
17703  if(offset >= str->length)
17704  break;
17705 
17706  if(str->data[offset] != ',') {
17708  break;
17709  }
17710  ++offset;
17711  }
17712 
17713  if(retval == UA_STATUSCODE_GOOD && idx > 0) {
17714  range->dimensions = dimensions;
17715  range->dimensionsSize = idx;
17716  } else
17717  UA_free(dimensions);
17718 
17719  return retval;
17720 }
17721 
17722 /********************************/
17723 /* Information Model Operations */
17724 /********************************/
17725 
17727 getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
17728  UA_NodeId **typeHierarchy, size_t *typeHierarchySize) {
17729  size_t results_size = 20; // probably too big, but saves mallocs
17730  UA_NodeId *results = UA_malloc(sizeof(UA_NodeId) * results_size);
17731  if(!results)
17733 
17734  UA_StatusCode retval = UA_NodeId_copy(&rootRef->nodeId, &results[0]);
17735  if(retval != UA_STATUSCODE_GOOD) {
17736  UA_free(results);
17737  return retval;
17738  }
17739 
17740  const UA_Node *node = rootRef;
17741  size_t idx = 0; /* Current index (contains NodeId of node) */
17742  size_t last = 0; /* Index of the last element in the array */
17743  const UA_NodeId hasSubtypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17744  while(true) {
17745  for(size_t i = 0; i < node->referencesSize; ++i) {
17746  /* is the reference relevant? */
17747  if(node->references[i].isInverse != inverse ||
17748  !UA_NodeId_equal(&hasSubtypeNodeId, &node->references[i].referenceTypeId))
17749  continue;
17750 
17751  /* is the target already considered? (multi-inheritance) */
17752  UA_Boolean duplicate = false;
17753  for(size_t j = 0; j <= last; ++j) {
17754  if(UA_NodeId_equal(&node->references[i].targetId.nodeId, &results[j])) {
17755  duplicate = true;
17756  break;
17757  }
17758  }
17759  if(duplicate)
17760  continue;
17761 
17762  /* increase array length if necessary */
17763  if(last + 1 >= results_size) {
17764  UA_NodeId *new_results =
17765  UA_realloc(results, sizeof(UA_NodeId) * results_size * 2);
17766  if(!new_results) {
17768  break;
17769  }
17770  results = new_results;
17771  results_size *= 2;
17772  }
17773 
17774  /* copy new nodeid to the end of the list */
17775  retval = UA_NodeId_copy(&node->references[i].targetId.nodeId, &results[++last]);
17776  if(retval != UA_STATUSCODE_GOOD)
17777  break;
17778  }
17779 
17780  /* Get the next node */
17781  next:
17782  ++idx;
17783  if(idx > last || retval != UA_STATUSCODE_GOOD)
17784  break;
17785  node = UA_NodeStore_get(ns, &results[idx]);
17786  if(!node || node->nodeClass != rootRef->nodeClass)
17787  goto next;
17788  }
17789 
17790  if(retval != UA_STATUSCODE_GOOD) {
17791  UA_Array_delete(results, last, &UA_TYPES[UA_TYPES_NODEID]);
17792  return retval;
17793  }
17794 
17795  *typeHierarchy = results;
17796  *typeHierarchySize = last + 1;
17797  return UA_STATUSCODE_GOOD;
17798 }
17799 
17800 UA_Boolean
17801 isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind,
17802  const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize) {
17803  if(UA_NodeId_equal(leafNode, nodeToFind))
17804  return true;
17805 
17806  const UA_Node *node = UA_NodeStore_get(ns,leafNode);
17807  if(!node)
17808  return false;
17809 
17810  /* Search upwards in the tree */
17811  for(size_t i = 0; i < node->referencesSize; ++i) {
17812  if(!node->references[i].isInverse)
17813  continue;
17814 
17815  /* Recurse only for valid reference types */
17816  for(size_t j = 0; j < referenceTypeIdsSize; ++j) {
17817  if(UA_NodeId_equal(&node->references[i].referenceTypeId, &referenceTypeIds[j]) &&
17818  isNodeInTree(ns, &node->references[i].targetId.nodeId, nodeToFind,
17819  referenceTypeIds, referenceTypeIdsSize))
17820  return true;
17821  }
17822  }
17823  return false;
17824 }
17825 
17826 const UA_Node *
17827 getNodeType(UA_Server *server, const UA_Node *node) {
17828  /* The reference to the parent is different for variable and variabletype */
17829  UA_NodeId parentRef;
17830  UA_Boolean inverse;
17831  if(node->nodeClass == UA_NODECLASS_VARIABLE ||
17832  node->nodeClass == UA_NODECLASS_OBJECT) {
17833  parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
17834  inverse = false;
17835  } else if(node->nodeClass == UA_NODECLASS_VARIABLETYPE ||
17836  /* node->nodeClass == UA_NODECLASS_OBJECTTYPE || // objecttype may have multiple parents */
17837  node->nodeClass == UA_NODECLASS_REFERENCETYPE ||
17838  node->nodeClass == UA_NODECLASS_DATATYPE) {
17839  parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17840  inverse = true;
17841  } else {
17842  return NULL;
17843  }
17844 
17845  /* stop at the first matching candidate */
17846  UA_NodeId *parentId = NULL;
17847  for(size_t i = 0; i < node->referencesSize; ++i) {
17848  if(node->references[i].isInverse == inverse &&
17849  UA_NodeId_equal(&node->references[i].referenceTypeId, &parentRef)) {
17850  parentId = &node->references[i].targetId.nodeId;
17851  break;
17852  }
17853  }
17854 
17855  if(!parentId)
17856  return NULL;
17857  return UA_NodeStore_get(server->nodestore, parentId);
17858 }
17859 
17860 const UA_VariableTypeNode *
17861 getVariableNodeType(UA_Server *server, const UA_VariableNode *node) {
17862  const UA_Node *type = getNodeType(server, (const UA_Node*)node);
17863  if(!type || type->nodeClass != UA_NODECLASS_VARIABLETYPE)
17864  return NULL;
17865  return (const UA_VariableTypeNode*)type;
17866 }
17867 
17868 const UA_ObjectTypeNode *
17869 getObjectNodeType(UA_Server *server, const UA_ObjectNode *node) {
17870  const UA_Node *type = getNodeType(server, (const UA_Node*)node);
17871  if(type->nodeClass != UA_NODECLASS_OBJECTTYPE)
17872  return NULL;
17873  return (const UA_ObjectTypeNode*)type;
17874 }
17875 
17876 UA_Boolean
17877 UA_Node_hasSubTypeOrInstances(const UA_Node *node) {
17878  const UA_NodeId hasSubType = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17879  const UA_NodeId hasTypeDefinition = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
17880  for(size_t i = 0; i < node->referencesSize; ++i) {
17881  if(node->references[i].isInverse == false &&
17882  UA_NodeId_equal(&node->references[i].referenceTypeId, &hasSubType))
17883  return true;
17884  if(node->references[i].isInverse == true &&
17885  UA_NodeId_equal(&node->references[i].referenceTypeId, &hasTypeDefinition))
17886  return true;
17887  }
17888  return false;
17889 }
17890 
17891 /* For mulithreading: make a copy of the node, edit and replace.
17892  * For singletrheading: edit the original */
17894 UA_Server_editNode(UA_Server *server, UA_Session *session,
17895  const UA_NodeId *nodeId, UA_EditNodeCallback callback,
17896  const void *data) {
17897 #ifndef UA_ENABLE_MULTITHREADING
17898  const UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
17899  if(!node)
17901  UA_Node *editNode = (UA_Node*)(uintptr_t)node; // dirty cast
17902  return callback(server, session, editNode, data);
17903 #else
17904  UA_StatusCode retval;
17905  do {
17906  UA_Node *copy = UA_NodeStore_getCopy(server->nodestore, nodeId);
17907  if(!copy)
17909  retval = callback(server, session, copy, data);
17910  if(retval != UA_STATUSCODE_GOOD) {
17912  return retval;
17913  }
17914  retval = UA_NodeStore_replace(server->nodestore, copy);
17915  } while(retval != UA_STATUSCODE_GOOD);
17916  return UA_STATUSCODE_GOOD;
17917 #endif
17918 }
17919 
17920 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_worker.c" ***********************************/
17921 
17922 /* This Source Code Form is subject to the terms of the Mozilla Public
17923 * License, v. 2.0. If a copy of the MPL was not distributed with this
17924 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17925 
17926 
17962 #define MAXTIMEOUT 50 // max timeout in millisec until the next main loop iteration
17963 
17964 static void
17965 processJob(UA_Server *server, UA_Job *job) {
17967  UA_RCU_LOCK();
17968  switch(job->type) {
17969  case UA_JOBTYPE_NOTHING:
17970  break;
17971  case UA_JOBTYPE_DETACHCONNECTION:
17973  break;
17974  case UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER:
17975  UA_Server_processBinaryMessage(server, job->job.binaryMessage.connection,
17976  &job->job.binaryMessage.message);
17977  UA_Connection *connection = job->job.binaryMessage.connection;
17978  connection->releaseRecvBuffer(connection, &job->job.binaryMessage.message);
17979  break;
17980  case UA_JOBTYPE_BINARYMESSAGE_ALLOCATED:
17981  UA_Server_processBinaryMessage(server, job->job.binaryMessage.connection,
17982  &job->job.binaryMessage.message);
17983  UA_ByteString_deleteMembers(&job->job.binaryMessage.message);
17984  break;
17985  case UA_JOBTYPE_METHODCALL:
17986  case UA_JOBTYPE_METHODCALL_DELAYED:
17987  job->job.methodCall.method(server, job->job.methodCall.data);
17988  break;
17989  default:
17990  UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER,
17991  "Trying to execute a job of unknown type");
17992  break;
17993  }
17994  UA_RCU_UNLOCK();
17995 }
17996 
17997 /*******************************/
17998 /* Worker Threads and Dispatch */
17999 /*******************************/
18000 
18001 #ifdef UA_ENABLE_MULTITHREADING
18002 
18003 struct MainLoopJob {
18004  struct cds_lfs_node node;
18005  UA_Job job;
18006 };
18007 
18008 struct DispatchJob {
18009  struct cds_wfcq_node node; // node for the queue
18010  UA_Job job;
18011 };
18012 
18013 static void *
18014 workerLoop(UA_Worker *worker) {
18015  UA_Server *server = worker->server;
18016  UA_UInt32 *counter = &worker->counter;
18017  volatile UA_Boolean *running = &worker->running;
18018 
18019  /* Initialize the (thread local) random seed with the ram address of worker */
18020  UA_random_seed((uintptr_t)worker);
18021  rcu_register_thread();
18022 
18023  while(*running) {
18024  struct DispatchJob *dj = (struct DispatchJob*)
18025  cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail);
18026  if(dj) {
18027  processJob(server, &dj->job);
18028  UA_free(dj);
18029  } else {
18030  /* nothing to do. sleep until a job is dispatched (and wakes up all worker threads) */
18031  pthread_mutex_lock(&server->dispatchQueue_mutex);
18032  pthread_cond_wait(&server->dispatchQueue_condition, &server->dispatchQueue_mutex);
18033  pthread_mutex_unlock(&server->dispatchQueue_mutex);
18034  }
18035  UA_atomic_add(counter, 1);
18036  }
18037 
18039  rcu_barrier(); // wait for all scheduled call_rcu work to complete
18040  rcu_unregister_thread();
18041  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "Worker shut down");
18042  return NULL;
18043 }
18044 
18045 static void
18046 dispatchJob(UA_Server *server, const UA_Job *job) {
18047  struct DispatchJob *dj = UA_malloc(sizeof(struct DispatchJob));
18048  dj->job = *job;
18049  cds_wfcq_node_init(&dj->node);
18050  cds_wfcq_enqueue(&server->dispatchQueue_head, &server->dispatchQueue_tail, &dj->node);
18051 }
18052 
18053 static void
18054 emptyDispatchQueue(UA_Server *server) {
18055  while(!cds_wfcq_empty(&server->dispatchQueue_head, &server->dispatchQueue_tail)) {
18056  struct DispatchJob *dj = (struct DispatchJob*)
18057  cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail);
18058  processJob(server, &dj->job);
18059  UA_free(dj);
18060  }
18061 }
18062 
18063 #endif
18064 
18065 /*****************/
18066 /* Repeated Jobs */
18067 /*****************/
18068 
18069 /* The linked list of jobs is sorted according to the next execution timestamp */
18070 struct RepeatedJob {
18071  LIST_ENTRY(RepeatedJob) next; /* Next element in the list */
18072  UA_DateTime nextTime; /* The next time when the jobs are to be executed */
18073  UA_UInt64 interval; /* Interval in 100ns resolution */
18074  UA_Guid id; /* Id of the repeated job */
18075  UA_Job job; /* The job description itself */
18076 };
18077 
18078 /* internal. call only from the main loop. */
18079 static void
18080 addRepeatedJob(UA_Server *server, struct RepeatedJob * UA_RESTRICT rj) {
18081  /* Search for the best position on the repeatedJobs sorted list. The goal is
18082  * to have many repeated jobs with the same repetition interval in a
18083  * "block". This helps to reduce the (linear) search to find the next entry
18084  * in the repeatedJobs list when dispatching the repeated jobs.
18085  * For this, we search between "nexttime_max - 1s" and "nexttime_max" for
18086  * entries with the same repetition interval and adjust the "nexttime".
18087  * Otherwise, add entry after the first element before "nexttime_max". */
18088  UA_DateTime nextTime_max = UA_DateTime_nowMonotonic() + (UA_Int64) rj->interval;
18089 
18090  struct RepeatedJob *afterRj = NULL;
18091  struct RepeatedJob *tmpRj;
18092  LIST_FOREACH(tmpRj, &server->repeatedJobs, next) {
18093  if(tmpRj->nextTime >= nextTime_max)
18094  break;
18095  if(tmpRj->interval == rj->interval &&
18096  tmpRj->nextTime > (nextTime_max - UA_SEC_TO_DATETIME))
18097  nextTime_max = tmpRj->nextTime; /* break in the next iteration */
18098  afterRj = tmpRj;
18099  }
18100 
18101  /* add the repeated job */
18102  rj->nextTime = nextTime_max;
18103  if(afterRj)
18104  LIST_INSERT_AFTER(afterRj, rj, next);
18105  else
18106  LIST_INSERT_HEAD(&server->repeatedJobs, rj, next);
18107 }
18108 
18110 UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
18111  UA_UInt32 interval, UA_Guid *jobId) {
18112  /* the interval needs to be at least 5ms */
18113  if(interval < 5)
18115  UA_UInt64 interval_dt =
18116  (UA_UInt64)interval * (UA_UInt64)UA_MSEC_TO_DATETIME; // from ms to 100ns resolution
18117 
18118  /* Create and fill the repeated job structure */
18119  struct RepeatedJob *rj = UA_malloc(sizeof(struct RepeatedJob));
18120  if(!rj)
18122  /* done inside addRepeatedJob:
18123  * rj->nextTime = UA_DateTime_nowMonotonic() + interval_dt; */
18124  rj->interval = interval_dt;
18125  rj->id = UA_Guid_random();
18126  rj->job = job;
18127 
18128 #ifdef UA_ENABLE_MULTITHREADING
18129  /* Call addRepeatedJob from the main loop */
18130  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18131  if(!mlw) {
18132  UA_free(rj);
18134  }
18135  mlw->job = (UA_Job) {
18136  .type = UA_JOBTYPE_METHODCALL,
18137  .job.methodCall = {.data = rj, .method = (void (*)(UA_Server*, void*))addRepeatedJob}};
18138  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18139 #else
18140  /* Add directly */
18141  addRepeatedJob(server, rj);
18142 #endif
18143  if(jobId)
18144  *jobId = rj->id;
18145  return UA_STATUSCODE_GOOD;
18146 }
18147 
18148 /* - Dispatches all repeated jobs that have timed out
18149  * - Reinserts dispatched job at their new position in the sorted list
18150  * - Returns the next datetime when a repeated job is scheduled */
18151 static UA_DateTime
18152 processRepeatedJobs(UA_Server *server, UA_DateTime current, UA_Boolean *dispatched) {
18153  /* Keep pointer to the previously dispatched job to avoid linear search for
18154  * "batched" jobs with the same nexttime and interval */
18155  struct RepeatedJob tmp_last;
18156  tmp_last.nextTime = current-1; /* never matches. just to avoid if(last_added && ...) */
18157  struct RepeatedJob *last_dispatched = &tmp_last;
18158 
18159  /* Iterate over the list of elements (sorted according to the nextTime timestamp) */
18160  struct RepeatedJob *rj, *tmp_rj;
18161  LIST_FOREACH_SAFE(rj, &server->repeatedJobs, next, tmp_rj) {
18162  if(rj->nextTime > current)
18163  break;
18164 
18165  /* Dispatch/process job */
18166 #ifdef UA_ENABLE_MULTITHREADING
18167  dispatchJob(server, &rj->job);
18168  *dispatched = true;
18169 #else
18170  struct RepeatedJob **previousNext = rj->next.le_prev;
18171  processJob(server, &rj->job);
18172  /* See if the current job was deleted during processJob. That means the
18173  * le_next field of the previous repeated job (could also be the list
18174  * head) does no longer point to the current repeated job */
18175  if((void*)*previousNext != (void*)rj) {
18176  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
18177  "The current repeated job removed itself");
18178  tmp_rj = LIST_FIRST(&server->repeatedJobs);
18179  continue;
18180  }
18181 
18182  /* Was tmp_rj removed during the job? */
18183  if(LIST_NEXT(rj, next) != tmp_rj)
18184  tmp_rj = LIST_FIRST(&server->repeatedJobs);
18185 #endif
18186 
18187  /* Set the time for the next execution */
18188  rj->nextTime += (UA_Int64)rj->interval;
18189 
18190  /* Prevent an infinite loop when the repeated jobs took more time than
18191  * rj->interval */
18192  if(rj->nextTime < current)
18193  rj->nextTime = current + 1;
18194 
18195  /* Find new position for rj to keep the list sorted */
18196  struct RepeatedJob *prev_rj;
18197  if(last_dispatched->nextTime == rj->nextTime) {
18198  /* We "batch" repeatedJobs with the same interval in
18199  * addRepeatedJobs. So this might occur quite often. */
18200  UA_assert(last_dispatched != &tmp_last);
18201  prev_rj = last_dispatched;
18202  } else {
18203  /* Find the position by a linear search */
18204  prev_rj = LIST_FIRST(&server->repeatedJobs);
18205  while(true) {
18206  struct RepeatedJob *n = LIST_NEXT(prev_rj, next);
18207  if(!n || n->nextTime >= rj->nextTime)
18208  break;
18209  prev_rj = n;
18210  }
18211  }
18212 
18213  /* Add entry */
18214  if(prev_rj != rj) {
18215  LIST_REMOVE(rj, next);
18216  LIST_INSERT_AFTER(prev_rj, rj, next);
18217  }
18218 
18219  /* Update last_dispatched and loop */
18220  last_dispatched = rj;
18221  }
18222 
18223  /* Check if the next repeated job is sooner than the usual timeout */
18224  struct RepeatedJob *first = LIST_FIRST(&server->repeatedJobs);
18225  UA_DateTime next = current + (MAXTIMEOUT * UA_MSEC_TO_DATETIME);
18226  if(first && first->nextTime < next)
18227  next = first->nextTime;
18228  return next;
18229 }
18230 
18231 /* Call this function only from the main loop! */
18232 static void
18233 removeRepeatedJob(UA_Server *server, UA_Guid *jobId) {
18234  struct RepeatedJob *rj, *rj_tmp;
18235  LIST_FOREACH_SAFE(rj, &server->repeatedJobs, next, rj_tmp) {
18236  if(!UA_Guid_equal(jobId, &rj->id))
18237  continue;
18238  LIST_REMOVE(rj, next);
18239  UA_free(rj);
18240  break;
18241  }
18242 #ifdef UA_ENABLE_MULTITHREADING
18243  UA_free(jobId);
18244 #endif
18245 }
18246 
18248 #ifdef UA_ENABLE_MULTITHREADING
18249  UA_Guid *idptr = UA_malloc(sizeof(UA_Guid));
18250  if(!idptr)
18252  *idptr = jobId;
18253  // dispatch to the mainloopjobs stack
18254  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18255  mlw->job = (UA_Job) {
18256  .type = UA_JOBTYPE_METHODCALL,
18257  .job.methodCall = {.data = idptr, .method = (void (*)(UA_Server*, void*))removeRepeatedJob}};
18258  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18259 #else
18260  removeRepeatedJob(server, &jobId);
18261 #endif
18262  return UA_STATUSCODE_GOOD;
18263 }
18264 
18265 void UA_Server_deleteAllRepeatedJobs(UA_Server *server) {
18266  struct RepeatedJob *current, *temp;
18267  LIST_FOREACH_SAFE(current, &server->repeatedJobs, next, temp) {
18268  LIST_REMOVE(current, next);
18269  UA_free(current);
18270  }
18271 }
18272 
18273 /****************/
18274 /* Delayed Jobs */
18275 /****************/
18276 
18277 static void
18278 delayed_free(UA_Server *server, void *data) {
18279  UA_free(data);
18280 }
18281 
18282 UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data) {
18283  return UA_Server_delayedCallback(server, delayed_free, data);
18284 }
18285 
18286 #ifndef UA_ENABLE_MULTITHREADING
18287 
18288 typedef struct UA_DelayedJob {
18289  SLIST_ENTRY(UA_DelayedJob) next;
18290  UA_Job job;
18291 } UA_DelayedJob;
18292 
18294 UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) {
18295  UA_DelayedJob *dj = UA_malloc(sizeof(UA_DelayedJob));
18296  if(!dj)
18298  dj->job.type = UA_JOBTYPE_METHODCALL;
18299  dj->job.job.methodCall.data = data;
18300  dj->job.job.methodCall.method = callback;
18301  SLIST_INSERT_HEAD(&server->delayedCallbacks, dj, next);
18302  return UA_STATUSCODE_GOOD;
18303 }
18304 
18305 static void
18306 processDelayedCallbacks(UA_Server *server) {
18307  UA_DelayedJob *dj, *dj_tmp;
18308  SLIST_FOREACH_SAFE(dj, &server->delayedCallbacks, next, dj_tmp) {
18309  SLIST_REMOVE(&server->delayedCallbacks, dj, UA_DelayedJob, next);
18310  processJob(server, &dj->job);
18311  UA_free(dj);
18312  }
18313 }
18314 
18315 #else
18316 
18317 #define DELAYEDJOBSSIZE 100 // Collect delayed jobs until we have DELAYEDWORKSIZE items
18318 
18319 struct DelayedJobs {
18320  struct DelayedJobs *next;
18321  UA_UInt32 *workerCounters; // initially NULL until the counter are set
18322  UA_UInt32 jobsCount; // the size of the array is DELAYEDJOBSSIZE, the count may be less
18323  UA_Job jobs[DELAYEDJOBSSIZE]; // when it runs full, a new delayedJobs entry is created
18324 };
18325 
18326 /* Dispatched as an ordinary job when the DelayedJobs list is full */
18327 static void getCounters(UA_Server *server, struct DelayedJobs *delayed) {
18328  UA_UInt32 *counters = UA_malloc(server->config.nThreads * sizeof(UA_UInt32));
18329  for(UA_UInt16 i = 0; i < server->config.nThreads; ++i)
18330  counters[i] = server->workers[i].counter;
18331  delayed->workerCounters = counters;
18332 }
18333 
18334 /* Call from the main thread only. This is the only function that modifies */
18335 /* server->delayedWork. processDelayedWorkQueue modifies the "next" (after the */
18336 /* head). */
18337 static void
18338 addDelayedJob(UA_Server *server, UA_Job *job) {
18339  struct DelayedJobs *dj = server->delayedJobs;
18340  if(!dj || dj->jobsCount >= DELAYEDJOBSSIZE) {
18341  /* create a new DelayedJobs and add it to the linked list */
18342  dj = UA_malloc(sizeof(struct DelayedJobs));
18343  if(!dj) {
18344  UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER,
18345  "Not enough memory to add a delayed job");
18346  return;
18347  }
18348  dj->jobsCount = 0;
18349  dj->workerCounters = NULL;
18350  dj->next = server->delayedJobs;
18351  server->delayedJobs = dj;
18352 
18353  /* dispatch a method that sets the counter for the full list that comes afterwards */
18354  if(dj->next) {
18355  UA_Job setCounter = (UA_Job){
18356  .type = UA_JOBTYPE_METHODCALL, .job.methodCall =
18357  {.method = (void (*)(UA_Server*, void*))getCounters, .data = dj->next}};
18358  dispatchJob(server, &setCounter);
18359  }
18360  }
18361  dj->jobs[dj->jobsCount] = *job;
18362  ++dj->jobsCount;
18363 }
18364 
18365 static void
18366 addDelayedJobAsync(UA_Server *server, UA_Job *job) {
18367  addDelayedJob(server, job);
18368  UA_free(job);
18369 }
18370 
18372 UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) {
18373  UA_Job *j = UA_malloc(sizeof(UA_Job));
18374  if(!j)
18376  j->type = UA_JOBTYPE_METHODCALL;
18377  j->job.methodCall.data = data;
18378  j->job.methodCall.method = callback;
18379  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18380  mlw->job = (UA_Job) {.type = UA_JOBTYPE_METHODCALL, .job.methodCall =
18381  {.data = j, .method = (UA_ServerCallback)addDelayedJobAsync}};
18382  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18383  return UA_STATUSCODE_GOOD;
18384 }
18385 
18386 /* Find out which delayed jobs can be executed now */
18387 static void
18388 dispatchDelayedJobs(UA_Server *server, void *_) {
18389  /* start at the second */
18390  struct DelayedJobs *dw = server->delayedJobs, *beforedw = dw;
18391  if(dw)
18392  dw = dw->next;
18393 
18394  /* find the first delayedwork where the counters have been set and have moved */
18395  while(dw) {
18396  if(!dw->workerCounters) {
18397  beforedw = dw;
18398  dw = dw->next;
18399  continue;
18400  }
18401  UA_Boolean allMoved = true;
18402  for(size_t i = 0; i < server->config.nThreads; ++i) {
18403  if(dw->workerCounters[i] == server->workers[i].counter) {
18404  allMoved = false;
18405  break;
18406  }
18407  }
18408  if(allMoved)
18409  break;
18410  beforedw = dw;
18411  dw = dw->next;
18412  }
18413 
18414  /* process and free all delayed jobs from here on */
18415  while(dw) {
18416  for(size_t i = 0; i < dw->jobsCount; ++i)
18417  processJob(server, &dw->jobs[i]);
18418  struct DelayedJobs *next = UA_atomic_xchg((void**)&beforedw->next, NULL);
18419  UA_free(dw->workerCounters);
18420  UA_free(dw);
18421  dw = next;
18422  }
18423 }
18424 
18425 #endif
18426 
18427 /********************/
18428 /* Main Server Loop */
18429 /********************/
18430 
18431 #ifdef UA_ENABLE_MULTITHREADING
18432 static void processMainLoopJobs(UA_Server *server) {
18433  /* no synchronization required if we only use push and pop_all */
18434  struct cds_lfs_head *head = __cds_lfs_pop_all(&server->mainLoopJobs);
18435  if(!head)
18436  return;
18437  struct MainLoopJob *mlw = (struct MainLoopJob*)&head->node;
18438  struct MainLoopJob *next;
18439  do {
18440  processJob(server, &mlw->job);
18441  next = (struct MainLoopJob*)mlw->node.next;
18442  UA_free(mlw);
18443  //cppcheck-suppress unreadVariable
18444  } while((mlw = next));
18445 }
18446 #endif
18447 
18449 #ifdef UA_ENABLE_MULTITHREADING
18450  /* Spin up the worker threads */
18451  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
18452  "Spinning up %u worker thread(s)", server->config.nThreads);
18453  pthread_cond_init(&server->dispatchQueue_condition, 0);
18454  pthread_mutex_init(&server->dispatchQueue_mutex, 0);
18455  server->workers = UA_malloc(server->config.nThreads * sizeof(UA_Worker));
18456  if(!server->workers)
18458  for(size_t i = 0; i < server->config.nThreads; ++i) {
18459  UA_Worker *worker = &server->workers[i];
18460  worker->server = server;
18461  worker->counter = 0;
18462  worker->running = true;
18463  pthread_create(&worker->thr, NULL, (void* (*)(void*))workerLoop, worker);
18464  }
18465 
18466  /* Try to execute delayed callbacks every 10 sec */
18467  UA_Job processDelayed = {.type = UA_JOBTYPE_METHODCALL,
18468  .job.methodCall = {.method = dispatchDelayedJobs, .data = NULL} };
18469  UA_Server_addRepeatedJob(server, processDelayed, 10000, NULL);
18470 #endif
18471 
18472  /* Start the networklayers */
18474  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18475  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18476  result |= nl->start(nl, server->config.logger);
18477  }
18478 
18479  return result;
18480 }
18481 
18482 /* completeMessages is run synchronous on the jobs returned from the network
18483  layer, so that the order for processing TCP packets is never mixed up. */
18484 static void
18485 completeMessages(UA_Server *server, UA_Job *job) {
18486  UA_Boolean realloced = UA_FALSE;
18488  &job->job.binaryMessage.message, &realloced);
18489  if(retval != UA_STATUSCODE_GOOD) {
18490  if(retval == UA_STATUSCODE_BADOUTOFMEMORY)
18491  UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_NETWORK,
18492  "Lost message(s) from Connection %i as memory could not be allocated",
18493  job->job.binaryMessage.connection->sockfd);
18494  else if(retval != UA_STATUSCODE_GOOD)
18495  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_NETWORK,
18496  "Could not merge half-received messages on Connection %i with error 0x%08x",
18497  job->job.binaryMessage.connection->sockfd, retval);
18498  job->type = UA_JOBTYPE_NOTHING;
18499  return;
18500  }
18501  if(realloced)
18502  job->type = UA_JOBTYPE_BINARYMESSAGE_ALLOCATED;
18503 
18504  /* discard the job if message is empty - also no leak is possible here */
18505  if(job->job.binaryMessage.message.length == 0)
18506  job->type = UA_JOBTYPE_NOTHING;
18507 }
18508 
18509 UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) {
18510 #ifdef UA_ENABLE_MULTITHREADING
18511  /* Run work assigned for the main thread */
18512  processMainLoopJobs(server);
18513 #endif
18514  /* Process repeated work */
18516  UA_Boolean dispatched = false; /* to wake up worker threads */
18517  UA_DateTime nextRepeated = processRepeatedJobs(server, now, &dispatched);
18518 
18519  UA_UInt16 timeout = 0;
18520  if(waitInternal)
18521  timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
18522 
18523  /* Get work from the networklayer */
18524  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18525  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18526  UA_Job *jobs = NULL;
18527  size_t jobsSize;
18528  /* only the last networklayer waits on the tieout */
18529  if(i == server->config.networkLayersSize-1)
18530  jobsSize = nl->getJobs(nl, &jobs, timeout);
18531  else
18532  jobsSize = nl->getJobs(nl, &jobs, 0);
18533 
18534  for(size_t k = 0; k < jobsSize; ++k) {
18535 #ifdef UA_ENABLE_MULTITHREADING
18536  /* Filter out delayed work */
18537  if(jobs[k].type == UA_JOBTYPE_METHODCALL_DELAYED) {
18538  addDelayedJob(server, &jobs[k]);
18539  jobs[k].type = UA_JOBTYPE_NOTHING;
18540  continue;
18541  }
18542 #endif
18543  /* Merge half-received messages */
18544  if(jobs[k].type == UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER)
18545  completeMessages(server, &jobs[k]);
18546  }
18547 
18548  /* Dispatch/process jobs */
18549  for(size_t j = 0; j < jobsSize; ++j) {
18550 #ifdef UA_ENABLE_MULTITHREADING
18551  dispatchJob(server, &jobs[j]);
18552  dispatched = true;
18553 #else
18554  processJob(server, &jobs[j]);
18555 #endif
18556  }
18557 
18558  /* Clean up jobs list */
18559  if(jobsSize > 0)
18560  UA_free(jobs);
18561  }
18562 
18563 #ifdef UA_ENABLE_MULTITHREADING
18564  /* Wake up worker threads */
18565  if(dispatched)
18566  pthread_cond_broadcast(&server->dispatchQueue_condition);
18567 #else
18568  processDelayedCallbacks(server);
18569 #endif
18570 
18571  now = UA_DateTime_nowMonotonic();
18572  timeout = 0;
18573  if(nextRepeated > now)
18574  timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
18575  return timeout;
18576 }
18577 
18579  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18580  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18581  UA_Job *stopJobs = NULL;
18582  size_t stopJobsSize = nl->stop(nl, &stopJobs);
18583  for(size_t j = 0; j < stopJobsSize; ++j)
18584  processJob(server, &stopJobs[j]);
18585  UA_free(stopJobs);
18586  }
18587 
18588 #ifdef UA_ENABLE_MULTITHREADING
18589  /* Ensure that run_shutdown can be called multiple times */
18590  if(server->workers) {
18591  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
18592  "Shutting down %u worker thread(s)", server->config.nThreads);
18593  /* Wait for all worker threads to finish */
18594  for(size_t i = 0; i < server->config.nThreads; ++i)
18595  server->workers[i].running = false;
18596  pthread_cond_broadcast(&server->dispatchQueue_condition);
18597  for(size_t i = 0; i < server->config.nThreads; ++i)
18598  pthread_join(server->workers[i].thr, NULL);
18599  /* Free the worker structures */
18600  UA_free(server->workers);
18601  server->workers = NULL;
18602  }
18603 
18604  /* Manually finish the work still enqueued */
18605  emptyDispatchQueue(server);
18607  rcu_barrier(); // wait for all scheduled call_rcu work to complete
18608 #else
18609  processDelayedCallbacks(server);
18610 #endif
18611  return UA_STATUSCODE_GOOD;
18612 }
18613 
18614 UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running) {
18615  UA_StatusCode retval = UA_Server_run_startup(server);
18616  if(retval != UA_STATUSCODE_GOOD)
18617  return retval;
18618  while(*running)
18619  UA_Server_run_iterate(server, true);
18620  return UA_Server_run_shutdown(server);
18621 }
18622 
18623 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_securechannel_manager.c" ***********************************/
18624 
18625 /* This Source Code Form is subject to the terms of the Mozilla Public
18626 * License, v. 2.0. If a copy of the MPL was not distributed with this
18627 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18628 
18629 
18630 #define STARTCHANNELID 1
18631 #define STARTTOKENID 1
18632 
18635  LIST_INIT(&cm->channels);
18636  cm->lastChannelId = STARTCHANNELID;
18637  cm->lastTokenId = STARTTOKENID;
18638  cm->currentChannelCount = 0;
18639  cm->server = server;
18640  return UA_STATUSCODE_GOOD;
18641 }
18642 
18644  channel_list_entry *entry, *temp;
18645  LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) {
18646  LIST_REMOVE(entry, pointers);
18648  UA_free(entry);
18649  }
18650 }
18651 
18652 static void
18653 removeSecureChannelCallback(UA_Server *server, void *entry) {
18654  channel_list_entry *centry = (channel_list_entry*)entry;
18656  UA_free(entry);
18657 }
18658 
18659 static UA_StatusCode
18660 removeSecureChannel(UA_SecureChannelManager *cm, channel_list_entry *entry){
18661  /* Add a delayed callback to remove the channel when the currently
18662  * scheduled jobs have completed */
18663  UA_StatusCode retval = UA_Server_delayedCallback(cm->server, removeSecureChannelCallback, entry);
18664  if(retval != UA_STATUSCODE_GOOD) {
18665  UA_LOG_WARNING(cm->server->config.logger, UA_LOGCATEGORY_SESSION,
18666  "Could not remove the secure channel with error code %s",
18667  UA_StatusCode_name(retval));
18668  return retval; /* Try again next time */
18669  }
18670 
18671  /* Detach the channel and make the capacity available */
18672  LIST_REMOVE(entry, pointers);
18673  UA_atomic_add(&cm->currentChannelCount, (UA_UInt32)-1);
18674  return UA_STATUSCODE_GOOD;
18675 }
18676 
18677 /* remove channels that were not renewed or who have no connection attached */
18678 void
18680  channel_list_entry *entry, *temp;
18681  LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) {
18682  UA_DateTime timeout = entry->channel.securityToken.createdAt +
18684  if(timeout < nowMonotonic || !entry->channel.connection) {
18685  UA_LOG_INFO_CHANNEL(cm->server->config.logger, &entry->channel,
18686  "SecureChannel has timed out");
18687  removeSecureChannel(cm, entry);
18688  } else if(entry->channel.nextSecurityToken.tokenId > 0) {
18690  }
18691  }
18692 }
18693 
18694 /* remove the first channel that has no session attached */
18695 static UA_Boolean purgeFirstChannelWithoutSession(UA_SecureChannelManager *cm) {
18696  channel_list_entry *entry;
18697  LIST_FOREACH(entry, &cm->channels, pointers) {
18698  if(LIST_EMPTY(&(entry->channel.sessions))){
18699  UA_LOG_DEBUG_CHANNEL(cm->server->config.logger, &entry->channel,
18700  "Channel was purged since maxSecureChannels was "
18701  "reached and channel had no session attached");
18702  removeSecureChannel(cm, entry);
18703  UA_assert(entry != LIST_FIRST(&cm->channels));
18704  return true;
18705  }
18706  }
18707  return false;
18708 }
18709 
18712  const UA_OpenSecureChannelRequest *request,
18713  UA_OpenSecureChannelResponse *response) {
18716 
18717  //check if there exists a free SC, otherwise try to purge one SC without a session
18718  //the purge has been introduced to pass CTT, it is not clear what strategy is expected here
18719  if(cm->currentChannelCount >= cm->server->config.maxSecureChannels && !purgeFirstChannelWithoutSession(cm)){
18721  }
18722 
18723  /* Set up the channel */
18725  if(!entry)
18727  UA_SecureChannel_init(&entry->channel);
18728  entry->channel.securityToken.channelId = cm->lastChannelId++;
18729  entry->channel.securityToken.tokenId = cm->lastTokenId++;
18732  (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) ?
18733  cm->server->config.maxSecurityTokenLifetime : request->requestedLifetime;
18734  if(entry->channel.securityToken.revisedLifetime == 0) /* lifetime 0 -> set the maximum possible */
18735  entry->channel.securityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime;
18736  UA_ByteString_copy(&request->clientNonce, &entry->channel.clientNonce);
18738  UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None");
18740 
18741  /* Set the response */
18742  UA_ByteString_copy(&entry->channel.serverNonce, &response->serverNonce);
18743  UA_ChannelSecurityToken_copy(&entry->channel.securityToken, &response->securityToken);
18745 
18746  /* Now overwrite the creation date with the internal monotonic clock */
18748 
18749  /* Set all the pointers internally */
18751  LIST_INSERT_HEAD(&cm->channels, entry, pointers);
18752  UA_atomic_add(&cm->currentChannelCount, 1);
18753  return UA_STATUSCODE_GOOD;
18754 }
18755 
18758  const UA_OpenSecureChannelRequest *request,
18759  UA_OpenSecureChannelResponse *response) {
18760  UA_SecureChannel *channel = conn->channel;
18761  if(!channel)
18763 
18764  /* if no security token is already issued */
18765  if(channel->nextSecurityToken.tokenId == 0) {
18766  channel->nextSecurityToken.channelId = channel->securityToken.channelId;
18767  channel->nextSecurityToken.tokenId = cm->lastTokenId++;
18770  (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) ?
18771  cm->server->config.maxSecurityTokenLifetime : request->requestedLifetime;
18772  if(channel->nextSecurityToken.revisedLifetime == 0) /* lifetime 0 -> return the max lifetime */
18773  channel->nextSecurityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime;
18774  }
18775 
18776  /* invalidate the old nonce */
18777  if(channel->clientNonce.data)
18778  UA_ByteString_deleteMembers(&channel->clientNonce);
18779 
18780  /* set the response */
18781  UA_ByteString_copy(&request->clientNonce, &channel->clientNonce);
18782  UA_ByteString_copy(&channel->serverNonce, &response->serverNonce);
18783  UA_ChannelSecurityToken_copy(&channel->nextSecurityToken, &response->securityToken);
18784 
18785  /* reset the creation date to the monotonic clock */
18787 
18788  return UA_STATUSCODE_GOOD;
18789 }
18790 
18793  channel_list_entry *entry;
18794  LIST_FOREACH(entry, &cm->channels, pointers) {
18795  if(entry->channel.securityToken.channelId == channelId)
18796  return &entry->channel;
18797  }
18798  return NULL;
18799 }
18800 
18803  channel_list_entry *entry;
18804  LIST_FOREACH(entry, &cm->channels, pointers) {
18805  if(entry->channel.securityToken.channelId == channelId)
18806  break;
18807  }
18808  if(!entry)
18810  return removeSecureChannel(cm, entry);
18811 }
18812 
18813 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_session_manager.c" ***********************************/
18814 
18815 /* This Source Code Form is subject to the terms of the Mozilla Public
18816 * License, v. 2.0. If a copy of the MPL was not distributed with this
18817 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18818 
18819 
18822  LIST_INIT(&sm->sessions);
18823  sm->currentSessionCount = 0;
18824  sm->server = server;
18825  return UA_STATUSCODE_GOOD;
18826 }
18827 
18829  session_list_entry *current, *temp;
18830  LIST_FOREACH_SAFE(current, &sm->sessions, pointers, temp) {
18831  LIST_REMOVE(current, pointers);
18832  UA_Session_deleteMembersCleanup(&current->session, sm->server);
18833  UA_free(current);
18834  }
18835 }
18836 
18837 /* Delayed callback to free the session memory */
18838 static void
18839 removeSessionCallback(UA_Server *server, void *entry) {
18840  session_list_entry *sentry = (session_list_entry*)entry;
18841  UA_Session_deleteMembersCleanup(&sentry->session, server);
18842  UA_free(sentry);
18843 }
18844 
18845 static UA_StatusCode
18846 removeSession(UA_SessionManager *sm, session_list_entry *sentry) {
18847  /* Deactivate the session */
18848  sentry->session.activated = false;
18849 
18850  /* Add a delayed callback to remove the session when the currently
18851  * scheduled jobs have completed */
18852  UA_StatusCode retval = UA_Server_delayedCallback(sm->server, removeSessionCallback, sentry);
18853  if(retval != UA_STATUSCODE_GOOD) {
18854  UA_LOG_WARNING_SESSION(sm->server->config.logger, &sentry->session,
18855  "Could not remove session with error code %s",
18856  UA_StatusCode_name(retval));
18857  return retval; /* Try again next time */
18858  }
18859 
18860  /* Detach the session and make the capacity available */
18861  LIST_REMOVE(sentry, pointers);
18862  UA_atomic_add(&sm->currentSessionCount, (UA_UInt32)-1);
18863  return UA_STATUSCODE_GOOD;
18864 }
18865 
18866 void
18868  UA_DateTime nowMonotonic) {
18869  session_list_entry *sentry, *temp;
18870  LIST_FOREACH_SAFE(sentry, &sm->sessions, pointers, temp) {
18871  /* Session has timed out? */
18872  if(sentry->session.validTill >= nowMonotonic)
18873  continue;
18874  UA_LOG_INFO_SESSION(sm->server->config.logger, &sentry->session,
18875  "Session has timed out");
18876  removeSession(sm, sentry);
18877  }
18878 }
18879 
18880 UA_Session *
18882  session_list_entry *current = NULL;
18883  LIST_FOREACH(current, &sm->sessions, pointers) {
18884  /* Token does not match */
18885  if(!UA_NodeId_equal(&current->session.authenticationToken, token))
18886  continue;
18887 
18888  /* Session has timed out */
18889  if(UA_DateTime_nowMonotonic() > current->session.validTill) {
18890  UA_LOG_INFO_SESSION(sm->server->config.logger, &current->session,
18891  "Client tries to use a session that has timed out");
18892  return NULL;
18893  }
18894 
18895  /* Ok, return */
18896  return &current->session;
18897  }
18898 
18899  /* Session not found */
18900  UA_LOG_INFO(sm->server->config.logger, UA_LOGCATEGORY_SESSION,
18901  "Try to use Session with token " UA_PRINTF_GUID_FORMAT " but is not found",
18903  return NULL;
18904 }
18905 
18906 /* Creates and adds a session. But it is not yet attached to a secure channel. */
18909  const UA_CreateSessionRequest *request, UA_Session **session) {
18910  if(sm->currentSessionCount >= sm->server->config.maxSessions)
18912 
18913  session_list_entry *newentry = UA_malloc(sizeof(session_list_entry));
18914  if(!newentry)
18916 
18917  UA_atomic_add(&sm->currentSessionCount, 1);
18918  UA_Session_init(&newentry->session);
18919  newentry->session.sessionId = UA_NODEID_GUID(1, UA_Guid_random());
18920  newentry->session.authenticationToken = UA_NODEID_GUID(1, UA_Guid_random());
18921 
18922  if(request->requestedSessionTimeout <= sm->server->config.maxSessionTimeout &&
18923  request->requestedSessionTimeout > 0)
18924  newentry->session.timeout = request->requestedSessionTimeout;
18925  else
18926  newentry->session.timeout = sm->server->config.maxSessionTimeout;
18927 
18928  UA_Session_updateLifetime(&newentry->session);
18929  LIST_INSERT_HEAD(&sm->sessions, newentry, pointers);
18930  *session = &newentry->session;
18931  return UA_STATUSCODE_GOOD;
18932 }
18933 
18936  session_list_entry *current;
18937  LIST_FOREACH(current, &sm->sessions, pointers) {
18938  if(UA_NodeId_equal(&current->session.authenticationToken, token))
18939  break;
18940  }
18941  if(!current)
18943  return removeSession(sm, current);
18944 }
18945 
18946 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodes.c" ***********************************/
18947 
18948 /* This Source Code Form is subject to the terms of the Mozilla Public
18949 * License, v. 2.0. If a copy of the MPL was not distributed with this
18950 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18951 
18952 
18954  /* delete standard content */
18955  UA_NodeId_deleteMembers(&node->nodeId);
18956  UA_QualifiedName_deleteMembers(&node->browseName);
18957  UA_LocalizedText_deleteMembers(&node->displayName);
18958  UA_LocalizedText_deleteMembers(&node->description);
18959  UA_Array_delete(node->references, node->referencesSize,
18961  node->references = NULL;
18962  node->referencesSize = 0;
18963 
18964  /* delete unique content of the nodeclass */
18965  switch(node->nodeClass) {
18966  case UA_NODECLASS_OBJECT:
18967  break;
18968  case UA_NODECLASS_METHOD:
18969  break;
18971  break;
18972  case UA_NODECLASS_VARIABLE:
18974  UA_VariableNode *p = (UA_VariableNode*)node;
18975  UA_NodeId_deleteMembers(&p->dataType);
18976  UA_Array_delete(p->arrayDimensions, p->arrayDimensionsSize,
18978  p->arrayDimensions = NULL;
18979  p->arrayDimensionsSize = 0;
18980  if(p->valueSource == UA_VALUESOURCE_DATA)
18981  UA_DataValue_deleteMembers(&p->value.data.value);
18982  break;
18983  }
18986  UA_LocalizedText_deleteMembers(&p->inverseName);
18987  break;
18988  }
18989  case UA_NODECLASS_DATATYPE:
18990  break;
18991  case UA_NODECLASS_VIEW:
18992  break;
18993  default:
18994  break;
18995  }
18996 }
18997 
18998 static UA_StatusCode
18999 UA_ObjectNode_copy(const UA_ObjectNode *src, UA_ObjectNode *dst) {
19000  dst->eventNotifier = src->eventNotifier;
19001  dst->instanceHandle = src->instanceHandle;
19002  return UA_STATUSCODE_GOOD;
19003 }
19004 
19005 static UA_StatusCode
19006 UA_CommonVariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) {
19007  UA_StatusCode retval = UA_Array_copy(src->arrayDimensions,
19008  src->arrayDimensionsSize,
19009  (void**)&dst->arrayDimensions,
19011  if(retval != UA_STATUSCODE_GOOD)
19012  return retval;
19013  dst->arrayDimensionsSize = src->arrayDimensionsSize;
19014  retval = UA_NodeId_copy(&src->dataType, &dst->dataType);
19015  dst->valueRank = src->valueRank;
19016  dst->valueSource = src->valueSource;
19017  if(src->valueSource == UA_VALUESOURCE_DATA) {
19018  retval |= UA_DataValue_copy(&src->value.data.value,
19019  &dst->value.data.value);
19020  dst->value.data.callback = src->value.data.callback;
19021  } else
19022  dst->value.dataSource = src->value.dataSource;
19023  return retval;
19024 }
19025 
19026 static UA_StatusCode
19027 UA_VariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) {
19028  UA_StatusCode retval = UA_CommonVariableNode_copy(src, dst);
19029  dst->accessLevel = src->accessLevel;
19030  dst->userAccessLevel = src->userAccessLevel;
19032  dst->historizing = src->historizing;
19033  return retval;
19034 }
19035 
19036 static UA_StatusCode
19037 UA_VariableTypeNode_copy(const UA_VariableTypeNode *src,
19038  UA_VariableTypeNode *dst) {
19039  UA_StatusCode retval = UA_CommonVariableNode_copy((const UA_VariableNode*)src,
19040  (UA_VariableNode*)dst);
19041  dst->isAbstract = src->isAbstract;
19042  return retval;
19043 }
19044 
19045 static UA_StatusCode
19046 UA_MethodNode_copy(const UA_MethodNode *src, UA_MethodNode *dst) {
19047  dst->executable = src->executable;
19048  dst->userExecutable = src->userExecutable;
19049  dst->methodHandle = src->methodHandle;
19050  dst->attachedMethod = src->attachedMethod;
19051  return UA_STATUSCODE_GOOD;
19052 }
19053 
19054 static UA_StatusCode
19055 UA_ObjectTypeNode_copy(const UA_ObjectTypeNode *src, UA_ObjectTypeNode *dst) {
19056  dst->isAbstract = src->isAbstract;
19058  return UA_STATUSCODE_GOOD;
19059 }
19060 
19061 static UA_StatusCode
19062 UA_ReferenceTypeNode_copy(const UA_ReferenceTypeNode *src,
19063  UA_ReferenceTypeNode *dst) {
19064  UA_StatusCode retval = UA_LocalizedText_copy(&src->inverseName,
19065  &dst->inverseName);
19066  dst->isAbstract = src->isAbstract;
19067  dst->symmetric = src->symmetric;
19068  return retval;
19069 }
19070 
19071 static UA_StatusCode
19072 UA_DataTypeNode_copy(const UA_DataTypeNode *src, UA_DataTypeNode *dst) {
19073  dst->isAbstract = src->isAbstract;
19074  return UA_STATUSCODE_GOOD;
19075 }
19076 
19077 static UA_StatusCode
19078 UA_ViewNode_copy(const UA_ViewNode *src, UA_ViewNode *dst) {
19079  dst->containsNoLoops = src->containsNoLoops;
19080  dst->eventNotifier = src->eventNotifier;
19081  return UA_STATUSCODE_GOOD;
19082 }
19083 
19084 UA_StatusCode UA_Node_copyAnyNodeClass(const UA_Node *src, UA_Node *dst) {
19085  if(src->nodeClass != dst->nodeClass)
19087 
19088  /* copy standard content */
19089  UA_StatusCode retval = UA_NodeId_copy(&src->nodeId, &dst->nodeId);
19090  dst->nodeClass = src->nodeClass;
19091  retval |= UA_QualifiedName_copy(&src->browseName, &dst->browseName);
19092  retval |= UA_LocalizedText_copy(&src->displayName, &dst->displayName);
19093  retval |= UA_LocalizedText_copy(&src->description, &dst->description);
19094  dst->writeMask = src->writeMask;
19095  dst->userWriteMask = src->userWriteMask;
19096  if(retval != UA_STATUSCODE_GOOD) {
19098  return retval;
19099  }
19100  retval |= UA_Array_copy(src->references, src->referencesSize,
19101  (void**)&dst->references,
19103  if(retval != UA_STATUSCODE_GOOD) {
19105  return retval;
19106  }
19107  dst->referencesSize = src->referencesSize;
19108 
19109  /* copy unique content of the nodeclass */
19110  switch(src->nodeClass) {
19111  case UA_NODECLASS_OBJECT:
19112  retval = UA_ObjectNode_copy((const UA_ObjectNode*)src,
19113  (UA_ObjectNode*)dst);
19114  break;
19115  case UA_NODECLASS_VARIABLE:
19116  retval = UA_VariableNode_copy((const UA_VariableNode*)src,
19117  (UA_VariableNode*)dst);
19118  break;
19119  case UA_NODECLASS_METHOD:
19120  retval = UA_MethodNode_copy((const UA_MethodNode*)src,
19121  (UA_MethodNode*)dst);
19122  break;
19124  retval = UA_ObjectTypeNode_copy((const UA_ObjectTypeNode*)src,
19125  (UA_ObjectTypeNode*)dst);
19126  break;
19128  retval = UA_VariableTypeNode_copy((const UA_VariableTypeNode*)src,
19129  (UA_VariableTypeNode*)dst);
19130  break;
19132  retval = UA_ReferenceTypeNode_copy((const UA_ReferenceTypeNode*)src,
19133  (UA_ReferenceTypeNode*)dst);
19134  break;
19135  case UA_NODECLASS_DATATYPE:
19136  retval = UA_DataTypeNode_copy((const UA_DataTypeNode*)src,
19137  (UA_DataTypeNode*)dst);
19138  break;
19139  case UA_NODECLASS_VIEW:
19140  retval = UA_ViewNode_copy((const UA_ViewNode*)src, (UA_ViewNode*)dst);
19141  break;
19142  default:
19143  break;
19144  }
19145 
19146  if(retval != UA_STATUSCODE_GOOD)
19148 
19149  return retval;
19150 }
19151 
19152 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore.c" ***********************************/
19153 
19154 /* This Source Code Form is subject to the terms of the Mozilla Public
19155 * License, v. 2.0. If a copy of the MPL was not distributed with this
19156 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19157 
19158 
19159 #ifndef UA_ENABLE_MULTITHREADING /* conditional compilation */
19160 
19161 #define UA_NODESTORE_MINSIZE 64
19162 
19163 typedef struct UA_NodeStoreEntry {
19164  struct UA_NodeStoreEntry *orig; // the version this is a copy from (or NULL)
19165  UA_Node node;
19167 
19168 #define UA_NODESTORE_TOMBSTONE ((UA_NodeStoreEntry*)0x01)
19169 
19175 };
19176 
19177 /* The size of the hash-map is always a prime number. They are chosen to be
19178  * close to the next power of 2. So the size ca. doubles with each prime. */
19179 static UA_UInt32 const primes[] = {
19180  7, 13, 31, 61, 127, 251,
19181  509, 1021, 2039, 4093, 8191, 16381,
19182  32749, 65521, 131071, 262139, 524287, 1048573,
19183  2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
19184  134217689, 268435399, 536870909, 1073741789, 2147483647, 4294967291
19185 };
19186 
19187 static UA_UInt32 mod(UA_UInt32 h, UA_UInt32 size) { return h % size; }
19188 static UA_UInt32 mod2(UA_UInt32 h, UA_UInt32 size) { return 1 + (h % (size - 2)); }
19189 
19190 static UA_UInt16
19191 higher_prime_index(UA_UInt32 n) {
19192  UA_UInt16 low = 0;
19193  UA_UInt16 high = (UA_UInt16)(sizeof(primes) / sizeof(UA_UInt32));
19194  while(low != high) {
19195  UA_UInt16 mid = (UA_UInt16)(low + ((high - low) / 2));
19196  if(n > primes[mid])
19197  low = (UA_UInt16)(mid + 1);
19198  else
19199  high = mid;
19200  }
19201  return low;
19202 }
19203 
19204 static UA_NodeStoreEntry *
19205 instantiateEntry(UA_NodeClass nodeClass) {
19206  size_t size = sizeof(UA_NodeStoreEntry) - sizeof(UA_Node);
19207  switch(nodeClass) {
19208  case UA_NODECLASS_OBJECT:
19209  size += sizeof(UA_ObjectNode);
19210  break;
19211  case UA_NODECLASS_VARIABLE:
19212  size += sizeof(UA_VariableNode);
19213  break;
19214  case UA_NODECLASS_METHOD:
19215  size += sizeof(UA_MethodNode);
19216  break;
19218  size += sizeof(UA_ObjectTypeNode);
19219  break;
19221  size += sizeof(UA_VariableTypeNode);
19222  break;
19224  size += sizeof(UA_ReferenceTypeNode);
19225  break;
19226  case UA_NODECLASS_DATATYPE:
19227  size += sizeof(UA_DataTypeNode);
19228  break;
19229  case UA_NODECLASS_VIEW:
19230  size += sizeof(UA_ViewNode);
19231  break;
19232  default:
19233  return NULL;
19234  }
19235  UA_NodeStoreEntry *entry = UA_calloc(1, size);
19236  if(!entry)
19237  return NULL;
19238  entry->node.nodeClass = nodeClass;
19239  return entry;
19240 }
19241 
19242 static void
19243 deleteEntry(UA_NodeStoreEntry *entry) {
19245  UA_free(entry);
19246 }
19247 
19248 /* returns slot of a valid node or null */
19249 static UA_NodeStoreEntry **
19250 findNode(const UA_NodeStore *ns, const UA_NodeId *nodeid) {
19251  UA_UInt32 h = UA_NodeId_hash(nodeid);
19252  UA_UInt32 size = ns->size;
19253  UA_UInt32 idx = mod(h, size);
19254  UA_UInt32 hash2 = mod2(h, size);
19255 
19256  while(true) {
19257  UA_NodeStoreEntry *e = ns->entries[idx];
19258  if(!e)
19259  return NULL;
19260  if(e > UA_NODESTORE_TOMBSTONE &&
19261  UA_NodeId_equal(&e->node.nodeId, nodeid))
19262  return &ns->entries[idx];
19263  idx += hash2;
19264  if(idx >= size)
19265  idx -= size;
19266  }
19267 
19268  /* NOTREACHED */
19269  return NULL;
19270 }
19271 
19272 /* returns an empty slot or null if the nodeid exists */
19273 static UA_NodeStoreEntry **
19274 findSlot(const UA_NodeStore *ns, const UA_NodeId *nodeid) {
19275  UA_UInt32 h = UA_NodeId_hash(nodeid);
19276  UA_UInt32 size = ns->size;
19277  UA_UInt32 idx = mod(h, size);
19278  UA_UInt32 hash2 = mod2(h, size);
19279 
19280  while(true) {
19281  UA_NodeStoreEntry *e = ns->entries[idx];
19282  if(e > UA_NODESTORE_TOMBSTONE &&
19283  UA_NodeId_equal(&e->node.nodeId, nodeid))
19284  return NULL;
19285  if(ns->entries[idx] <= UA_NODESTORE_TOMBSTONE)
19286  return &ns->entries[idx];
19287  idx += hash2;
19288  if(idx >= size)
19289  idx -= size;
19290  }
19291 
19292  /* NOTREACHED */
19293  return NULL;
19294 }
19295 
19296 /* The occupancy of the table after the call will be about 50% */
19297 static UA_StatusCode
19298 expand(UA_NodeStore *ns) {
19299  UA_UInt32 osize = ns->size;
19300  UA_UInt32 count = ns->count;
19301  /* Resize only when table after removal of unused elements is either too
19302  full or too empty */
19303  if(count * 2 < osize && (count * 8 > osize || osize <= UA_NODESTORE_MINSIZE))
19304  return UA_STATUSCODE_GOOD;
19305 
19306  UA_NodeStoreEntry **oentries = ns->entries;
19307  UA_UInt32 nindex = higher_prime_index(count * 2);
19308  UA_UInt32 nsize = primes[nindex];
19309  UA_NodeStoreEntry **nentries = UA_calloc(nsize, sizeof(UA_NodeStoreEntry*));
19310  if(!nentries)
19312 
19313  ns->entries = nentries;
19314  ns->size = nsize;
19315  ns->sizePrimeIndex = nindex;
19316 
19317  /* recompute the position of every entry and insert the pointer */
19318  for(size_t i = 0, j = 0; i < osize && j < count; ++i) {
19319  if(oentries[i] <= UA_NODESTORE_TOMBSTONE)
19320  continue;
19321  UA_NodeStoreEntry **e = findSlot(ns, &oentries[i]->node.nodeId);
19322  UA_assert(e);
19323  *e = oentries[i];
19324  ++j;
19325  }
19326 
19327  UA_free(oentries);
19328  return UA_STATUSCODE_GOOD;
19329 }
19330 
19331 /**********************/
19332 /* Exported functions */
19333 /**********************/
19334 
19335 UA_NodeStore *
19337  UA_NodeStore *ns = UA_malloc(sizeof(UA_NodeStore));
19338  if(!ns)
19339  return NULL;
19340  ns->sizePrimeIndex = higher_prime_index(UA_NODESTORE_MINSIZE);
19341  ns->size = primes[ns->sizePrimeIndex];
19342  ns->count = 0;
19343  ns->entries = UA_calloc(ns->size, sizeof(UA_NodeStoreEntry*));
19344  if(!ns->entries) {
19345  UA_free(ns);
19346  return NULL;
19347  }
19348  return ns;
19349 }
19350 
19351 void
19353  UA_UInt32 size = ns->size;
19354  UA_NodeStoreEntry **entries = ns->entries;
19355  for(UA_UInt32 i = 0; i < size; ++i) {
19356  if(entries[i] > UA_NODESTORE_TOMBSTONE)
19357  deleteEntry(entries[i]);
19358  }
19359  UA_free(ns->entries);
19360  UA_free(ns);
19361 }
19362 
19363 UA_Node *
19365  UA_NodeStoreEntry *entry = instantiateEntry(nodeClass);
19366  if(!entry)
19367  return NULL;
19368  return &entry->node;
19369 }
19370 
19371 void
19372 UA_NodeStore_deleteNode(UA_Node *node) {
19373  UA_NodeStoreEntry *entry = container_of(node, UA_NodeStoreEntry, node);
19374  UA_assert(&entry->node == node);
19375  deleteEntry(entry);
19376 }
19377 
19379 UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
19380  if(ns->size * 3 <= ns->count * 4) {
19381  if(expand(ns) != UA_STATUSCODE_GOOD)
19383  }
19384 
19385  UA_NodeId tempNodeid;
19386  tempNodeid = node->nodeId;
19387  tempNodeid.namespaceIndex = 0;
19388  UA_NodeStoreEntry **entry;
19389  if(UA_NodeId_isNull(&tempNodeid)) {
19390  /* create a random nodeid */
19391  if(node->nodeId.namespaceIndex == 0)
19392  node->nodeId.namespaceIndex = 1;
19393  UA_UInt32 identifier = ns->count+1; // start value
19394  UA_UInt32 size = ns->size;
19395  UA_UInt32 increase = mod2(identifier, size);
19396  while(true) {
19397  node->nodeId.identifier.numeric = identifier;
19398  entry = findSlot(ns, &node->nodeId);
19399  if(entry)
19400  break;
19401  identifier += increase;
19402  if(identifier >= size)
19403  identifier -= size;
19404  }
19405  } else {
19406  entry = findSlot(ns, &node->nodeId);
19407  if(!entry) {
19410  }
19411  }
19412 
19413  *entry = container_of(node, UA_NodeStoreEntry, node);
19414  ++ns->count;
19415  UA_assert(&(*entry)->node == node);
19416  return UA_STATUSCODE_GOOD;
19417 }
19418 
19420 UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node) {
19421  UA_NodeStoreEntry **entry = findNode(ns, &node->nodeId);
19422  if(!entry)
19424  UA_NodeStoreEntry *newEntry = container_of(node, UA_NodeStoreEntry, node);
19425  if(*entry != newEntry->orig) {
19426  // the node was replaced since the copy was made
19427  deleteEntry(newEntry);
19429  }
19430  deleteEntry(*entry);
19431  *entry = newEntry;
19432  return UA_STATUSCODE_GOOD;
19433 }
19434 
19435 const UA_Node *
19437  UA_NodeStoreEntry **entry = findNode(ns, nodeid);
19438  if(!entry)
19439  return NULL;
19440  return (const UA_Node*)&(*entry)->node;
19441 }
19442 
19443 UA_Node *
19445  UA_NodeStoreEntry **slot = findNode(ns, nodeid);
19446  if(!slot)
19447  return NULL;
19448  UA_NodeStoreEntry *entry = *slot;
19449  UA_NodeStoreEntry *new = instantiateEntry(entry->node.nodeClass);
19450  if(!new)
19451  return NULL;
19452  if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
19453  deleteEntry(new);
19454  return NULL;
19455  }
19456  new->orig = entry; // store the pointer to the original
19457  return &new->node;
19458 }
19459 
19462  UA_NodeStoreEntry **slot = findNode(ns, nodeid);
19463  if(!slot)
19465  deleteEntry(*slot);
19466  *slot = UA_NODESTORE_TOMBSTONE;
19467  --ns->count;
19468  /* Downsize the hashmap if it is very empty */
19469  if(ns->count * 8 < ns->size && ns->size > 32)
19470  expand(ns); // this can fail. we just continue with the bigger hashmap.
19471  return UA_STATUSCODE_GOOD;
19472 }
19473 
19474 void
19476  for(UA_UInt32 i = 0; i < ns->size; ++i) {
19477  if(ns->entries[i] > UA_NODESTORE_TOMBSTONE)
19478  visitor((UA_Node*)&ns->entries[i]->node);
19479  }
19480 }
19481 
19482 #endif /* UA_ENABLE_MULTITHREADING */
19483 
19484 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore_concurrent.c" ***********************************/
19485 
19486 /* This Source Code Form is subject to the terms of the Mozilla Public
19487 * License, v. 2.0. If a copy of the MPL was not distributed with this
19488 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19489 
19490 
19491 #ifdef UA_ENABLE_MULTITHREADING /* conditional compilation */
19492 #include <urcu/rculfhash.h>
19493 
19494 struct nodeEntry {
19495  struct cds_lfht_node htn;
19496  struct rcu_head rcu_head;
19497  struct nodeEntry *orig; //< the version this is a copy from (or NULL)
19498  UA_Node node;
19499 };
19500 
19501 static struct nodeEntry * instantiateEntry(UA_NodeClass class) {
19502  size_t size = sizeof(struct nodeEntry) - sizeof(UA_Node);
19503  switch(class) {
19504  case UA_NODECLASS_OBJECT:
19505  size += sizeof(UA_ObjectNode);
19506  break;
19507  case UA_NODECLASS_VARIABLE:
19508  size += sizeof(UA_VariableNode);
19509  break;
19510  case UA_NODECLASS_METHOD:
19511  size += sizeof(UA_MethodNode);
19512  break;
19514  size += sizeof(UA_ObjectTypeNode);
19515  break;
19517  size += sizeof(UA_VariableTypeNode);
19518  break;
19520  size += sizeof(UA_ReferenceTypeNode);
19521  break;
19522  case UA_NODECLASS_DATATYPE:
19523  size += sizeof(UA_DataTypeNode);
19524  break;
19525  case UA_NODECLASS_VIEW:
19526  size += sizeof(UA_ViewNode);
19527  break;
19528  default:
19529  return NULL;
19530  }
19531  struct nodeEntry *entry = UA_calloc(1, size);
19532  if(!entry)
19533  return NULL;
19534  entry->node.nodeClass = class;
19535  return entry;
19536 }
19537 
19538 static void deleteEntry(struct rcu_head *head) {
19539  struct nodeEntry *entry = container_of(head, struct nodeEntry, rcu_head);
19540  UA_Node_deleteMembersAnyNodeClass(&entry->node);
19541  UA_free(entry);
19542 }
19543 
19544 /* We are in a rcu_read lock. So the node will not be freed under our feet. */
19545 static int compare(struct cds_lfht_node *htn, const void *orig) {
19546  const UA_NodeId *origid = (const UA_NodeId *)orig;
19547  /* The htn is first in the entry structure. */
19548  const UA_NodeId *newid = &((struct nodeEntry *)htn)->node.nodeId;
19549  return UA_NodeId_equal(newid, origid);
19550 }
19551 
19553  /* 64 is the minimum size for the hashtable. */
19554  return (UA_NodeStore*)cds_lfht_new(64, 64, 0, CDS_LFHT_AUTO_RESIZE, NULL);
19555 }
19556 
19557 /* do not call with read-side critical section held!! */
19560  struct cds_lfht *ht = (struct cds_lfht*)ns;
19561  struct cds_lfht_iter iter;
19562  cds_lfht_first(ht, &iter);
19563  while(iter.node) {
19564  if(!cds_lfht_del(ht, iter.node)) {
19565  /* points to the htn entry, which is first */
19566  struct nodeEntry *entry = (struct nodeEntry*) iter.node;
19567  call_rcu(&entry->rcu_head, deleteEntry);
19568  }
19569  cds_lfht_next(ht, &iter);
19570  }
19571  UA_RCU_UNLOCK();
19572  cds_lfht_destroy(ht, NULL);
19573  UA_RCU_LOCK();
19574 }
19575 
19576 UA_Node * UA_NodeStore_newNode(UA_NodeClass class) {
19577  struct nodeEntry *entry = instantiateEntry(class);
19578  if(!entry)
19579  return NULL;
19580  return (UA_Node*)&entry->node;
19581 }
19582 
19583 void UA_NodeStore_deleteNode(UA_Node *node) {
19584  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19585  deleteEntry(&entry->rcu_head);
19586 }
19587 
19588 UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
19590  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19591  struct cds_lfht *ht = (struct cds_lfht*)ns;
19592  cds_lfht_node_init(&entry->htn);
19593  struct cds_lfht_node *result;
19594  //namespace index is assumed to be valid
19595  UA_NodeId tempNodeid;
19596  tempNodeid = node->nodeId;
19597  tempNodeid.namespaceIndex = 0;
19598  if(!UA_NodeId_isNull(&tempNodeid)) {
19599  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19600  result = cds_lfht_add_unique(ht, h, compare, &node->nodeId, &entry->htn);
19601  /* If the nodeid exists already */
19602  if(result != &entry->htn) {
19603  deleteEntry(&entry->rcu_head);
19605  }
19606  } else {
19607  /* create a unique nodeid */
19608  node->nodeId.identifierType = UA_NODEIDTYPE_NUMERIC;
19609  if(node->nodeId.namespaceIndex == 0) // original request for ns=0 should yield ns=1
19610  node->nodeId.namespaceIndex = 1;
19611 
19612  unsigned long identifier;
19613  long before, after;
19614  cds_lfht_count_nodes(ht, &before, &identifier, &after); // current number of nodes stored
19615  ++identifier;
19616 
19617  node->nodeId.identifier.numeric = (UA_UInt32)identifier;
19618  while(true) {
19619  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19620  result = cds_lfht_add_unique(ht, h, compare, &node->nodeId, &entry->htn);
19621  if(result == &entry->htn)
19622  break;
19623  node->nodeId.identifier.numeric += (UA_UInt32)(identifier * 2654435761);
19624  }
19625  }
19626  return UA_STATUSCODE_GOOD;
19627 }
19628 
19629 UA_StatusCode UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node) {
19631  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19632  struct cds_lfht *ht = (struct cds_lfht*)ns;
19633 
19634  /* Get the current version */
19635  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19636  struct cds_lfht_iter iter;
19637  cds_lfht_lookup(ht, h, compare, &node->nodeId, &iter);
19638  if(!iter.node)
19640 
19641  /* We try to replace an obsolete version of the node */
19642  struct nodeEntry *oldEntry = (struct nodeEntry*)iter.node;
19643  if(oldEntry != entry->orig) {
19644  deleteEntry(&entry->rcu_head);
19646  }
19647 
19648  cds_lfht_node_init(&entry->htn);
19649  if(cds_lfht_replace(ht, &iter, h, compare, &node->nodeId, &entry->htn) != 0) {
19650  /* Replacing failed. Maybe the node got replaced just before this thread tried to.*/
19651  deleteEntry(&entry->rcu_head);
19653  }
19654 
19655  /* If an entry got replaced, mark it as dead. */
19656  call_rcu(&oldEntry->rcu_head, deleteEntry);
19657  return UA_STATUSCODE_GOOD;
19658 }
19659 
19662  struct cds_lfht *ht = (struct cds_lfht*)ns;
19663  UA_UInt32 h = UA_NodeId_hash(nodeid);
19664  struct cds_lfht_iter iter;
19665  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19666  if(!iter.node || cds_lfht_del(ht, iter.node) != 0)
19668  struct nodeEntry *entry = (struct nodeEntry*)iter.node;
19669  call_rcu(&entry->rcu_head, deleteEntry);
19670  return UA_STATUSCODE_GOOD;
19671 }
19672 
19673 const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid) {
19675  struct cds_lfht *ht = (struct cds_lfht*)ns;
19676  UA_UInt32 h = UA_NodeId_hash(nodeid);
19677  struct cds_lfht_iter iter;
19678  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19679  struct nodeEntry *found_entry = (struct nodeEntry*)iter.node;
19680  if(!found_entry)
19681  return NULL;
19682  return &found_entry->node;
19683 }
19684 
19685 UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid) {
19687  struct cds_lfht *ht = (struct cds_lfht*)ns;
19688  UA_UInt32 h = UA_NodeId_hash(nodeid);
19689  struct cds_lfht_iter iter;
19690  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19691  struct nodeEntry *entry = (struct nodeEntry*)iter.node;
19692  if(!entry)
19693  return NULL;
19694  struct nodeEntry *new = instantiateEntry(entry->node.nodeClass);
19695  if(!new)
19696  return NULL;
19697  if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
19698  deleteEntry(&new->rcu_head);
19699  return NULL;
19700  }
19701  new->orig = entry;
19702  return &new->node;
19703 }
19704 
19707  struct cds_lfht *ht = (struct cds_lfht*)ns;
19708  struct cds_lfht_iter iter;
19709  cds_lfht_first(ht, &iter);
19710  while(iter.node != NULL) {
19711  struct nodeEntry *found_entry = (struct nodeEntry*)iter.node;
19712  visitor(&found_entry->node);
19713  cds_lfht_next(ht, &iter);
19714  }
19715 }
19716 
19717 #endif /* UA_ENABLE_MULTITHREADING */
19718 
19719 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_discovery.c" ***********************************/
19720 
19721 /* This Source Code Form is subject to the terms of the Mozilla Public
19722 * License, v. 2.0. If a copy of the MPL was not distributed with this
19723 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19724 
19725 
19726 void Service_FindServers(UA_Server *server, UA_Session *session,
19727  const UA_FindServersRequest *request, UA_FindServersResponse *response) {
19728  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing FindServersRequest");
19729  /* copy ApplicationDescription from the config */
19731  if(!descr) {
19733  return;
19734  }
19735  response->responseHeader.serviceResult =
19736  UA_ApplicationDescription_copy(&server->config.applicationDescription, descr);
19738  UA_free(descr);
19739  return;
19740  }
19741 
19742  /* add the discoveryUrls from the networklayers */
19743  UA_String *disc = UA_realloc(descr->discoveryUrls, sizeof(UA_String) *
19744  (descr->discoveryUrlsSize + server->config.networkLayersSize));
19745  if(!disc) {
19747  UA_ApplicationDescription_delete(descr);
19748  return;
19749  }
19750  size_t existing = descr->discoveryUrlsSize;
19751  descr->discoveryUrls = disc;
19752  descr->discoveryUrlsSize += server->config.networkLayersSize;
19753 
19754  // TODO: Add nl only if discoveryUrl not already present
19755  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
19756  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
19757  UA_String_copy(&nl->discoveryUrl, &descr->discoveryUrls[existing + i]);
19758  }
19759 
19760  response->servers = descr;
19761  response->serversSize = 1;
19762 }
19763 
19764 void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request,
19765  UA_GetEndpointsResponse *response) {
19766  /* If the client expects to see a specific endpointurl, mirror it back. If
19767  not, clone the endpoints with the discovery url of all networklayers. */
19768  const UA_String *endpointUrl = &request->endpointUrl;
19769  if(endpointUrl->length > 0) {
19770  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with endpointUrl " \
19772  } else {
19773  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with an empty endpointUrl");
19774  }
19775 
19776  /* test if the supported binary profile shall be returned */
19777 #ifdef NO_ALLOCA
19778  UA_Boolean relevant_endpoints[server->endpointDescriptionsSize];
19779 #else
19780  UA_Boolean *relevant_endpoints = UA_alloca(sizeof(UA_Boolean) * server->endpointDescriptionsSize);
19781 #endif
19782  memset(relevant_endpoints, 0, sizeof(UA_Boolean) * server->endpointDescriptionsSize);
19783  size_t relevant_count = 0;
19784  if(request->profileUrisSize == 0) {
19785  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j)
19786  relevant_endpoints[j] = true;
19787  relevant_count = server->endpointDescriptionsSize;
19788  } else {
19789  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
19790  for(size_t i = 0; i < request->profileUrisSize; ++i) {
19792  continue;
19793  relevant_endpoints[j] = true;
19794  ++relevant_count;
19795  break;
19796  }
19797  }
19798  }
19799 
19800  if(relevant_count == 0) {
19801  response->endpointsSize = 0;
19802  return;
19803  }
19804 
19805  /* Clone the endpoint for each networklayer? */
19806  size_t clone_times = 1;
19807  UA_Boolean nl_endpointurl = false;
19808  if(endpointUrl->length == 0) {
19809  clone_times = server->config.networkLayersSize;
19810  nl_endpointurl = true;
19811  }
19812 
19813  response->endpoints = UA_Array_new(relevant_count * clone_times, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19814  if(!response->endpoints) {
19816  return;
19817  }
19818  response->endpointsSize = relevant_count * clone_times;
19819 
19820  size_t k = 0;
19822  for(size_t i = 0; i < clone_times; ++i) {
19823  if(nl_endpointurl)
19824  endpointUrl = &server->config.networkLayers[i].discoveryUrl;
19825  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
19826  if(!relevant_endpoints[j])
19827  continue;
19828  retval |= UA_EndpointDescription_copy(&server->endpointDescriptions[j], &response->endpoints[k]);
19829  retval |= UA_String_copy(endpointUrl, &response->endpoints[k].endpointUrl);
19830  ++k;
19831  }
19832  }
19833 
19834  if(retval != UA_STATUSCODE_GOOD) {
19835  response->responseHeader.serviceResult = retval;
19836  UA_Array_delete(response->endpoints, response->endpointsSize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19837  response->endpoints = NULL;
19838  response->endpointsSize = 0;
19839  return;
19840  }
19841 }
19842 
19843 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_securechannel.c" ***********************************/
19844 
19845 /* This Source Code Form is subject to the terms of the Mozilla Public
19846 * License, v. 2.0. If a copy of the MPL was not distributed with this
19847 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19848 
19849 
19850 void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
19851  const UA_OpenSecureChannelRequest *request,
19852  UA_OpenSecureChannelResponse *response) {
19853  // todo: if(request->clientProtocolVersion != protocolVersion)
19855  response->responseHeader.serviceResult =
19856  UA_SecureChannelManager_open(&server->secureChannelManager, connection, request, response);
19857 
19859  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19860  "Connection %i | SecureChannel %i | OpenSecureChannel: Opened SecureChannel",
19861  connection->sockfd, response->securityToken.channelId);
19862  } else {
19863  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19864  "Connection %i | OpenSecureChannel: Opening a SecureChannel failed",
19865  connection->sockfd);
19866  }
19867  } else {
19868  response->responseHeader.serviceResult =
19869  UA_SecureChannelManager_renew(&server->secureChannelManager, connection, request, response);
19870 
19872  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19873  "Connection %i | SecureChannel %i | OpenSecureChannel: SecureChannel renewed",
19874  connection->sockfd, response->securityToken.channelId);
19875  } else {
19876  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19877  "Connection %i | OpenSecureChannel: Renewing SecureChannel failed",
19878  connection->sockfd);
19879  }
19880  }
19881 }
19882 
19883 /* The server does not send a CloseSecureChannel response */
19884 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel) {
19885  UA_LOG_INFO_CHANNEL(server->config.logger, channel, "CloseSecureChannel");
19887 }
19888 
19889 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_session.c" ***********************************/
19890 
19891 /* This Source Code Form is subject to the terms of the Mozilla Public
19892 * License, v. 2.0. If a copy of the MPL was not distributed with this
19893 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19894 
19895 
19896 void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
19897  const UA_CreateSessionRequest *request,
19898  UA_CreateSessionResponse *response) {
19899  if(channel->securityToken.channelId == 0) {
19901  return;
19902  }
19903 
19904  /* Copy the server's endpoint into the response */
19905  response->responseHeader.serviceResult =
19907  (void**)&response->serverEndpoints, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19909  return;
19910  response->serverEndpointsSize = server->endpointDescriptionsSize;
19911 
19912  /* Mirror back the endpointUrl */
19913  for(size_t i = 0; i < response->serverEndpointsSize; ++i)
19914  UA_String_copy(&request->endpointUrl, &response->serverEndpoints[i].endpointUrl);
19915 
19916  UA_Session *newSession;
19917  response->responseHeader.serviceResult =
19918  UA_SessionManager_createSession(&server->sessionManager, channel, request, &newSession);
19920  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Processing CreateSessionRequest failed");
19921  return;
19922  }
19923 
19924  newSession->maxResponseMessageSize = request->maxResponseMessageSize;
19925  newSession->maxRequestMessageSize = channel->connection->localConf.maxMessageSize;
19926  response->sessionId = newSession->sessionId;
19927  response->revisedSessionTimeout = (UA_Double)newSession->timeout;
19928  response->authenticationToken = newSession->authenticationToken;
19929  response->responseHeader.serviceResult = UA_String_copy(&request->sessionName, &newSession->sessionName);
19930  if(server->endpointDescriptionsSize > 0)
19931  response->responseHeader.serviceResult |=
19932  UA_ByteString_copy(&server->endpointDescriptions->serverCertificate,
19933  &response->serverCertificate);
19936  return;
19937  }
19938  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Session " UA_PRINTF_GUID_FORMAT " created",
19940 }
19941 
19942 void
19943 Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
19944  UA_Session *session, const UA_ActivateSessionRequest *request,
19945  UA_ActivateSessionResponse *response) {
19946  if(session->validTill < UA_DateTime_nowMonotonic()) {
19947  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
19948  "to activate, but the session has timed out", channel->securityToken.channelId);
19950  return;
19951  }
19952 
19956  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
19957  "to activate, but the UserIdentify token is invalid", channel->securityToken.channelId);
19959  return;
19960  }
19961 
19962 
19963  UA_String ap = UA_STRING(ANONYMOUS_POLICY);
19964  UA_String up = UA_STRING(USERNAME_POLICY);
19965 
19966  /* Compatibility notice: Siemens OPC Scout v10 provides an empty policyId,
19967  this is not okay For compatibility we will assume that empty policyId == ANONYMOUS_POLICY
19968  if(token.policyId->data == NULL)
19969  response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
19970  */
19971 
19972  if(server->config.enableAnonymousLogin &&
19974  /* anonymous login */
19975  const UA_AnonymousIdentityToken *token = request->userIdentityToken.content.decoded.data;
19976  if(token->policyId.data && !UA_String_equal(&token->policyId, &ap)) {
19978  return;
19979  }
19980  } else if(server->config.enableUsernamePasswordLogin &&
19981  request->userIdentityToken.content.decoded.type == &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]) {
19982  /* username login */
19983  const UA_UserNameIdentityToken *token = request->userIdentityToken.content.decoded.data;
19984  if(!UA_String_equal(&token->policyId, &up)) {
19986  return;
19987  }
19988  if(token->encryptionAlgorithm.length > 0) {
19989  /* we don't support encryption */
19991  return;
19992  }
19993 
19994  if(token->userName.length == 0 && token->password.length == 0) {
19995  /* empty username and password */
19997  return;
19998  }
19999 
20000  /* trying to match pw/username */
20001  UA_Boolean match = false;
20002  for(size_t i = 0; i < server->config.usernamePasswordLoginsSize; ++i) {
20003  UA_String *user = &server->config.usernamePasswordLogins[i].username;
20004  UA_String *pw = &server->config.usernamePasswordLogins[i].password;
20005  if(UA_String_equal(&token->userName, user) && UA_String_equal(&token->password, pw)) {
20006  match = true;
20007  break;
20008  }
20009  }
20010  if(!match) {
20011  UA_LOG_INFO_SESSION(server->config.logger, session,
20012  "ActivateSession: Did not find matching username/password");
20014  return;
20015  }
20016  } else {
20017  /* Unsupported token type */
20019  return;
20020  }
20021 
20022  /* Detach the old SecureChannel */
20023  if(session->channel && session->channel != channel) {
20024  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Detach from old channel");
20025  UA_SecureChannel_detachSession(session->channel, session);
20026  }
20027 
20028  /* Attach to the SecureChannel and activate */
20029  UA_SecureChannel_attachSession(channel, session);
20030  session->activated = true;
20031  UA_Session_updateLifetime(session);
20032  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Session activated");
20033 }
20034 
20035 void
20036 Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request,
20037  UA_CloseSessionResponse *response) {
20038  UA_LOG_INFO_SESSION(server->config.logger, session, "CloseSession");
20039  response->responseHeader.serviceResult =
20041 }
20042 
20043 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_attribute.c" ***********************************/
20044 
20045 /* This Source Code Form is subject to the terms of the Mozilla Public
20046 * License, v. 2.0. If a copy of the MPL was not distributed with this
20047 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
20048 
20049 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
20050 #endif
20051 
20052 /* Force cast from const data for zero-copy reading. The storage type is set to
20053  nodelete. So the value is not deleted. Use with care! */
20054 static void
20055 forceVariantSetScalar(UA_Variant *v, const void *p, const UA_DataType *t) {
20056  UA_Variant_init(v);
20057  v->type = t;
20058  v->data = (void*)(uintptr_t)p;
20060 }
20061 
20062 /*****************/
20063 /* Type Checking */
20064 /*****************/
20065 
20070 };
20071 
20072 static enum type_equivalence
20073 typeEquivalence(const UA_DataType *t) {
20074  if(t->membersSize != 1 || !t->members[0].namespaceZero)
20075  return TYPE_EQUIVALENCE_NONE;
20077  return TYPE_EQUIVALENCE_ENUM;
20078  if(t->members[0].memberTypeIndex == UA_TYPES_BYTE && t->members[0].isArray)
20079  return TYPE_EQUIVALENCE_OPAQUE;
20080  return TYPE_EQUIVALENCE_NONE;
20081 }
20082 
20083 /* Test whether a valurank and the given arraydimensions are compatible. zero
20084  * array dimensions indicate a scalar */
20085 static UA_StatusCode
20086 compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize) {
20087  switch(valueRank) {
20088  case -3: /* the value can be a scalar or a one dimensional array */
20089  if(arrayDimensionsSize > 1)
20091  break;
20092  case -2: /* the value can be a scalar or an array with any number of dimensions */
20093  break;
20094  case -1: /* the value is a scalar */
20095  if(arrayDimensionsSize > 0)
20097  break;
20098  case 0: /* the value is an array with one or more dimensions */
20099  if(arrayDimensionsSize < 1)
20101  break;
20102  default: /* >= 1: the value is an array with the specified number of dimensions */
20103  if(valueRank < 0)
20105  /* Must hold if the array has a defined length. Null arrays (length -1)
20106  * need to be caught before. */
20107  if(arrayDimensionsSize != (size_t)valueRank)
20109  }
20110  return UA_STATUSCODE_GOOD;
20111 }
20112 
20113 /* Check if the valuerank allows for the value dimension */
20114 static UA_StatusCode
20115 compatibleValueRankValue(UA_Int32 valueRank, const UA_Variant *value) {
20116  /* empty arrays (-1) always match */
20117  if(value->data == NULL)
20118  return UA_STATUSCODE_GOOD;
20119 
20120  size_t arrayDims = value->arrayDimensionsSize;
20121  if(!UA_Variant_isScalar(value))
20122  arrayDims = 1; /* array but no arraydimensions -> implicit array dimension 1 */
20123  return compatibleValueRankArrayDimensions(valueRank, arrayDims);
20124 }
20125 
20127 compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
20128  const UA_UInt32 *constraintArrayDimensions,
20129  size_t testArrayDimensionsSize,
20130  const UA_UInt32 *testArrayDimensions) {
20131  /* No array dimensions defined -> everything is permitted if the value rank fits */
20132  if(constraintArrayDimensionsSize == 0) {
20133  return UA_STATUSCODE_GOOD;
20134  }
20135 
20136  /* Dimension count must match */
20137  if(testArrayDimensionsSize != constraintArrayDimensionsSize)
20139 
20140  /* Dimension lengths must match; zero in the constraint is a wildcard */
20141  for(size_t i = 0; i < constraintArrayDimensionsSize; ++i) {
20142  if(constraintArrayDimensions[i] != testArrayDimensions[i] &&
20143  constraintArrayDimensions[i] != 0)
20145  }
20146  return UA_STATUSCODE_GOOD;
20147 }
20148 
20149 /* Returns the pointer to a datavalue with a possibly transformed type to match
20150  the description */
20151 static const UA_Variant *
20152 convertToMatchingValue(UA_Server *server, const UA_Variant *value,
20153  const UA_NodeId *targetDataTypeId, UA_Variant *editableValue) {
20154  const UA_DataType *targetDataType = UA_findDataType(targetDataTypeId);
20155  if(!targetDataType)
20156  return NULL;
20157 
20158  /* A string is written to a byte array. the valuerank and array
20159  dimensions are checked later */
20160  if(targetDataType == &UA_TYPES[UA_TYPES_BYTE] &&
20161  value->type == &UA_TYPES[UA_TYPES_BYTESTRING] &&
20162  UA_Variant_isScalar(value)) {
20163  UA_ByteString *str = (UA_ByteString*)value->data;
20164  editableValue->storageType = UA_VARIANT_DATA_NODELETE;
20165  editableValue->type = &UA_TYPES[UA_TYPES_BYTE];
20166  editableValue->arrayLength = str->length;
20167  editableValue->data = str->data;
20168  return editableValue;
20169  }
20170 
20171  /* An enum was sent as an int32, or an opaque type as a bytestring. This
20172  * is detected with the typeIndex indicating the "true" datatype. */
20173  enum type_equivalence te1 = typeEquivalence(targetDataType);
20174  enum type_equivalence te2 = typeEquivalence(value->type);
20175  if(te1 != TYPE_EQUIVALENCE_NONE && te1 == te2) {
20176  *editableValue = *value;
20177  editableValue->storageType = UA_VARIANT_DATA_NODELETE;
20178  editableValue->type = targetDataType;
20179  return editableValue;
20180  }
20181 
20182  /* No more possible equivalencies */
20183  return NULL;
20184 }
20185 
20186 /* Test whether the value matches a variable definition given by
20187  * - datatype
20188  * - valueranke
20189  * - array dimensions.
20190  * Sometimes it can be necessary to transform the content of the value, e.g.
20191  * byte array to bytestring or uint32 to some enum. If editableValue is non-NULL,
20192  * we try to create a matching variant that points to the original data. */
20194 typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId,
20195  UA_Int32 targetValueRank, size_t targetArrayDimensionsSize,
20196  const UA_UInt32 *targetArrayDimensions, const UA_Variant *value,
20197  const UA_NumericRange *range, UA_Variant *editableValue) {
20198  /* Empty variant is only allowed for BaseDataType */
20199  if(!value->type)
20200  goto check_array;
20201 
20202  /* See if the types match. The nodeid on the wire may be != the nodeid in
20203  * the node for opaque types, enums and bytestrings. value contains the
20204  * correct type definition after the following paragraph */
20205  if(UA_NodeId_equal(&value->type->typeId, targetDataTypeId))
20206  goto check_array;
20207 
20208  /* Has the value a subtype of the required type? */
20209  const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
20210  if(isNodeInTree(server->nodestore, &value->type->typeId, targetDataTypeId, &subtypeId, 1))
20211  goto check_array;
20212 
20213  /* Try to convert to a matching value if this is wanted */
20214  if(!editableValue)
20216  value = convertToMatchingValue(server, value, targetDataTypeId, editableValue);
20217  if(!value)
20219 
20220  check_array:
20221  if(range) /* array dimensions are checked later when writing the range */
20222  return UA_STATUSCODE_GOOD;
20223 
20224  size_t valueArrayDimensionsSize = value->arrayDimensionsSize;
20225  UA_UInt32 *valueArrayDimensions = value->arrayDimensions;
20226  UA_UInt32 tempArrayDimensions;
20227  if(valueArrayDimensions == 0 && !UA_Variant_isScalar(value)) {
20228  valueArrayDimensionsSize = 1;
20229  tempArrayDimensions = (UA_UInt32)value->arrayLength;
20230  valueArrayDimensions = &tempArrayDimensions;
20231  }
20232 
20233  /* See if the array dimensions match. When arrayDimensions are defined, they
20234  * already hold the valuerank. */
20235  if(targetArrayDimensionsSize > 0)
20236  return compatibleArrayDimensions(targetArrayDimensionsSize, targetArrayDimensions,
20237  valueArrayDimensionsSize, valueArrayDimensions);
20238 
20239  /* Check if the valuerank allows for the value dimension */
20240  return compatibleValueRankValue(targetValueRank, value);
20241 }
20242 
20243 /*****************************/
20244 /* ArrayDimensions Attribute */
20245 /*****************************/
20246 
20247 static UA_StatusCode
20248 readArrayDimensionsAttribute(const UA_VariableNode *vn, UA_DataValue *v) {
20249  UA_Variant_setArray(&v->value, vn->arrayDimensions,
20250  vn->arrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
20252  v->hasValue = true;
20253  return UA_STATUSCODE_GOOD;
20254 }
20255 
20256 static UA_StatusCode
20257 writeArrayDimensionsAttribute(UA_Server *server, UA_VariableNode *node,
20258  size_t arrayDimensionsSize, UA_UInt32 *arrayDimensions) {
20259  /* If this is a variabletype, there must be no instances or subtypes of it
20260  * when we do the change */
20261  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20262  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20264 
20265  /* Check that the array dimensions match with the valuerank */
20266  UA_StatusCode retval = compatibleValueRankArrayDimensions(node->valueRank, arrayDimensionsSize);
20267  if(retval != UA_STATUSCODE_GOOD) {
20268  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20269  "The current value rank does not match the new array dimensions");
20270  return retval;
20271  }
20272 
20273  /* Get the VariableType */
20274  const UA_VariableTypeNode *vt = getVariableNodeType(server, (UA_VariableNode*)node);
20275  if(!vt)
20277 
20278  /* Check if the array dimensions match with the wildcards in the
20279  * variabletype (dimension length 0) */
20280  if(vt->arrayDimensions) {
20281  retval = compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions,
20282  arrayDimensionsSize, arrayDimensions);
20283  if(retval != UA_STATUSCODE_GOOD) {
20284  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20285  "Array dimensions in the variable type do not match");
20286  return retval;
20287  }
20288  }
20289 
20290  /* Check if the current value is compatible with the array dimensions */
20291  UA_DataValue value;
20292  UA_DataValue_init(&value);
20293  retval = readValueAttribute(server, node, &value);
20294  if(retval != UA_STATUSCODE_GOOD)
20295  return retval;
20296  if(value.hasValue) {
20297  retval = compatibleArrayDimensions(arrayDimensionsSize, arrayDimensions,
20298  value.value.arrayDimensionsSize,
20299  value.value.arrayDimensions);
20300  UA_DataValue_deleteMembers(&value);
20301  if(retval != UA_STATUSCODE_GOOD) {
20302  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20303  "Array dimensions in the current value do not match");
20304  return retval;
20305  }
20306  }
20307 
20308  /* Ok, apply */
20309  UA_UInt32 *oldArrayDimensions = node->arrayDimensions;
20310  retval = UA_Array_copy(arrayDimensions, arrayDimensionsSize,
20311  (void**)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]);
20312  if(retval != UA_STATUSCODE_GOOD)
20313  return retval;
20314  UA_free(oldArrayDimensions);
20315  node->arrayDimensionsSize = arrayDimensionsSize;
20316  return UA_STATUSCODE_GOOD;
20317 }
20318 
20319 /***********************/
20320 /* ValueRank Attribute */
20321 /***********************/
20322 
20323 static UA_StatusCode
20324 writeValueRankAttributeWithVT(UA_Server *server, UA_VariableNode *node,
20325  UA_Int32 valueRank) {
20326  const UA_VariableTypeNode *vt = getVariableNodeType(server, node);
20327  if(!vt)
20329  return writeValueRankAttribute(server, node, valueRank, vt->valueRank);
20330 }
20331 
20333 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank,
20334  UA_Int32 constraintValueRank) {
20335  /* If this is a variabletype, there must be no instances or subtypes of it
20336  when we do the change */
20337  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20338  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20340 
20341  /* Check if the valuerank of the variabletype allows the change. */
20342  switch(constraintValueRank) {
20343  case -3: /* the value can be a scalar or a one dimensional array */
20344  if(valueRank != -1 && valueRank != 1)
20346  break;
20347  case -2: /* the value can be a scalar or an array with any number of dimensions */
20348  break;
20349  case -1: /* the value is a scalar */
20350  if(valueRank != -1)
20352  break;
20353  case 0: /* the value is an array with one or more dimensions */
20354  if(valueRank < 0)
20356  break;
20357  default: /* >= 1: the value is an array with the specified number of dimensions */
20358  if(valueRank != constraintValueRank)
20360  break;
20361  }
20362 
20363  /* Check if the new valuerank is compatible with the array dimensions. Use
20364  * the read service to handle data sources. */
20365  size_t arrayDims = node->arrayDimensionsSize;
20367  if(arrayDims == 0) {
20368  /* the value could be an array with no arrayDimensions defined.
20369  dimensions zero indicate a scalar for compatibleValueRankArrayDimensions. */
20370  UA_DataValue value;
20371  UA_DataValue_init(&value);
20372  retval = readValueAttribute(server, node, &value);
20373  if(retval != UA_STATUSCODE_GOOD)
20374  return retval;
20375  if(!value.hasValue || value.value.data == NULL)
20376  goto apply; /* no value or null array */
20377  if(!UA_Variant_isScalar(&value.value))
20378  arrayDims = 1;
20379  UA_DataValue_deleteMembers(&value);
20380  }
20381  retval = compatibleValueRankArrayDimensions(valueRank, arrayDims);
20382  if(retval != UA_STATUSCODE_GOOD)
20383  return retval;
20384 
20385  /* All good, apply the change */
20386  apply:
20387  node->valueRank = valueRank;
20388  return UA_STATUSCODE_GOOD;
20389 }
20390 
20391 /**********************/
20392 /* DataType Attribute */
20393 /**********************/
20394 
20395 static UA_StatusCode
20396 writeDataTypeAttributeWithVT(UA_Server *server, UA_VariableNode *node,
20397  const UA_NodeId *dataType) {
20398  const UA_VariableTypeNode *vt = getVariableNodeType(server, node);
20399  if(!vt)
20401  return writeDataTypeAttribute(server, node, dataType, &vt->dataType);
20402 }
20403 
20404 /* constraintDataType can be NULL, then we retrieve the vt */
20406 writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node,
20407  const UA_NodeId *dataType, const UA_NodeId *constraintDataType) {
20408  /* If this is a variabletype, there must be no instances or subtypes of it
20409  when we do the change */
20410  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20411  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20413 
20414  /* Does the new type match the constraints of the variabletype? */
20415  UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
20416  if(!isNodeInTree(server->nodestore, dataType,
20417  constraintDataType, &subtypeId, 1))
20419 
20420  /* Check if the current value would match the new type */
20421  UA_DataValue value;
20422  UA_DataValue_init(&value);
20423  UA_StatusCode retval = readValueAttribute(server, node, &value);
20424  if(retval != UA_STATUSCODE_GOOD)
20425  return retval;
20426  if(value.hasValue) {
20427  retval = typeCheckValue(server, dataType, node->valueRank,
20428  node->arrayDimensionsSize, node->arrayDimensions,
20429  &value.value, NULL, NULL);
20430  UA_DataValue_deleteMembers(&value);
20431  if(retval != UA_STATUSCODE_GOOD) {
20432  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20433  "The current value does not match the new data type");
20434  return retval;
20435  }
20436  }
20437 
20438  /* Replace the datatype nodeid */
20439  UA_NodeId dtCopy = node->dataType;
20440  retval = UA_NodeId_copy(dataType, &node->dataType);
20441  if(retval != UA_STATUSCODE_GOOD) {
20442  node->dataType = dtCopy;
20443  return retval;
20444  }
20445  UA_NodeId_deleteMembers(&dtCopy);
20446  return UA_STATUSCODE_GOOD;
20447 }
20448 
20449 /*******************/
20450 /* Value Attribute */
20451 /*******************/
20452 
20453 static UA_StatusCode
20454 readValueAttributeFromNode(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v,
20455  UA_NumericRange *rangeptr) {
20456  if(vn->value.data.callback.onRead) {
20457  UA_RCU_UNLOCK();
20458  vn->value.data.callback.onRead(vn->value.data.callback.handle,
20459  vn->nodeId, &vn->value.data.value.value, rangeptr);
20460  UA_RCU_LOCK();
20461 #ifdef UA_ENABLE_MULTITHREADING
20462  /* Reopen the node to see the changes (multithreading only) */
20463  vn = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &vn->nodeId);
20464 #endif
20465  }
20466  if(rangeptr)
20467  return UA_Variant_copyRange(&vn->value.data.value.value, &v->value, *rangeptr);
20468  *v = vn->value.data.value;
20470  return UA_STATUSCODE_GOOD;
20471 }
20472 
20473 static UA_StatusCode
20474 readValueAttributeFromDataSource(const UA_VariableNode *vn, UA_DataValue *v,
20475  UA_TimestampsToReturn timestamps,
20476  UA_NumericRange *rangeptr) {
20477  if(!vn->value.dataSource.read)
20479  UA_Boolean sourceTimeStamp = (timestamps == UA_TIMESTAMPSTORETURN_SOURCE ||
20480  timestamps == UA_TIMESTAMPSTORETURN_BOTH);
20481 
20482  UA_RCU_UNLOCK();
20483  UA_StatusCode retval =
20484  vn->value.dataSource.read(vn->value.dataSource.handle, vn->nodeId,
20485  sourceTimeStamp, rangeptr, v);
20486  UA_RCU_LOCK();
20487  return retval;
20488 }
20489 
20490 static UA_StatusCode
20491 readValueAttributeComplete(UA_Server *server, const UA_VariableNode *vn,
20492  UA_TimestampsToReturn timestamps, const UA_String *indexRange,
20493  UA_DataValue *v) {
20494  /* Compute the index range */
20495  UA_NumericRange range;
20496  UA_NumericRange *rangeptr = NULL;
20498  if(indexRange && indexRange->length > 0) {
20499  retval = parse_numericrange(indexRange, &range);
20500  if(retval != UA_STATUSCODE_GOOD)
20501  return retval;
20502  rangeptr = &range;
20503  }
20504 
20505  /* Read the value */
20506  if(vn->valueSource == UA_VALUESOURCE_DATA)
20507  retval = readValueAttributeFromNode(server, vn, v, rangeptr);
20508  else
20509  retval = readValueAttributeFromDataSource(vn, v, timestamps, rangeptr);
20510 
20511  /* Clean up */
20512  if(rangeptr)
20513  UA_free(range.dimensions);
20514  return retval;
20515 }
20516 
20518 readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v) {
20519  return readValueAttributeComplete(server, vn, UA_TIMESTAMPSTORETURN_NEITHER, NULL, v);
20520 }
20521 
20522 static UA_StatusCode
20523 writeValueAttributeWithoutRange(UA_VariableNode *node, const UA_DataValue *value) {
20524  UA_DataValue old_value = node->value.data.value; /* keep the pointers for restoring */
20525  UA_StatusCode retval = UA_DataValue_copy(value, &node->value.data.value);
20526  if(retval == UA_STATUSCODE_GOOD)
20527  UA_DataValue_deleteMembers(&old_value);
20528  else
20529  node->value.data.value = old_value;
20530  return retval;
20531 }
20532 
20533 static UA_StatusCode
20534 writeValueAttributeWithRange(UA_VariableNode *node, const UA_DataValue *value,
20535  const UA_NumericRange *rangeptr) {
20536  /* Value on both sides? */
20537  if(value->status != node->value.data.value.status ||
20538  !value->hasValue || !node->value.data.value.hasValue)
20540 
20541  /* Make scalar a one-entry array for range matching */
20542  UA_Variant editableValue;
20543  const UA_Variant *v = &value->value;
20544  if(UA_Variant_isScalar(&value->value)) {
20545  editableValue = value->value;
20546  editableValue.arrayLength = 1;
20547  v = &editableValue;
20548  }
20549 
20550  /* Write the value */
20551  UA_StatusCode retval = UA_Variant_setRangeCopy(&node->value.data.value.value,
20552  v->data, v->arrayLength, *rangeptr);
20553  if(retval != UA_STATUSCODE_GOOD)
20554  return retval;
20555 
20556  /* Write the status and timestamps */
20557  node->value.data.value.hasStatus = value->hasStatus;
20558  node->value.data.value.status = value->status;
20559  node->value.data.value.hasSourceTimestamp = value->hasSourceTimestamp;
20560  node->value.data.value.sourceTimestamp = value->sourceTimestamp;
20561  node->value.data.value.hasSourcePicoseconds = value->hasSourcePicoseconds;
20562  node->value.data.value.sourcePicoseconds = value->sourcePicoseconds;
20563  return UA_STATUSCODE_GOOD;
20564 }
20565 
20567 writeValueAttribute(UA_Server *server, UA_VariableNode *node,
20568  const UA_DataValue *value, const UA_String *indexRange) {
20569  /* Parse the range */
20570  UA_NumericRange range;
20571  UA_NumericRange *rangeptr = NULL;
20573  if(indexRange && indexRange->length > 0) {
20574  retval = parse_numericrange(indexRange, &range);
20575  if(retval != UA_STATUSCODE_GOOD)
20576  return retval;
20577  rangeptr = &range;
20578  }
20579 
20580  /* Copy the value into an editable "container" where e.g. the datatype can
20581  * be adjusted. The data itself is not written into. */
20582  UA_DataValue editableValue = *value;
20583  editableValue.value.storageType = UA_VARIANT_DATA_NODELETE;
20584 
20585  /* Type checking. May change the type of editableValue */
20586  if(value->hasValue) {
20587  retval = typeCheckValue(server, &node->dataType, node->valueRank,
20588  node->arrayDimensionsSize, node->arrayDimensions,
20589  &value->value, rangeptr, &editableValue.value);
20590  if(retval != UA_STATUSCODE_GOOD)
20591  goto cleanup;
20592  }
20593 
20594  /* Set the source timestamp if there is none */
20595  if(!editableValue.hasSourceTimestamp) {
20596  editableValue.sourceTimestamp = UA_DateTime_now();
20597  editableValue.hasSourceTimestamp = true;
20598  }
20599 
20600  /* Ok, do it */
20601  if(node->valueSource == UA_VALUESOURCE_DATA) {
20602  if(!rangeptr)
20603  retval = writeValueAttributeWithoutRange(node, &editableValue);
20604  else
20605  retval = writeValueAttributeWithRange(node, &editableValue, rangeptr);
20606 
20607  /* Callback after writing */
20608  if(retval == UA_STATUSCODE_GOOD && node->value.data.callback.onWrite) {
20609  const UA_VariableNode *writtenNode;
20610 #ifdef UA_ENABLE_MULTITHREADING
20611  /* Reopen the node to see the changes (multithreading only) */
20612  writtenNode = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &node->nodeId);
20613 #else
20614  writtenNode = node; /* The node is written in-situ (TODO: this might
20615  change with the nodestore plugin approach) */
20616 #endif
20617  UA_RCU_UNLOCK();
20618  writtenNode->value.data.callback.onWrite(writtenNode->value.data.callback.handle,
20619  writtenNode->nodeId,
20620  &writtenNode->value.data.value.value, rangeptr);
20621  UA_RCU_LOCK();
20622  }
20623  } else {
20624  if(node->value.dataSource.write) {
20625  UA_RCU_UNLOCK();
20626  retval = node->value.dataSource.write(node->value.dataSource.handle,
20627  node->nodeId, &editableValue.value, rangeptr);
20628  UA_RCU_LOCK();
20629  } else {
20631  }
20632  }
20633 
20634  /* Clean up */
20635  cleanup:
20636  if(rangeptr)
20637  UA_free(range.dimensions);
20638  return retval;
20639 }
20640 
20641 /************************/
20642 /* IsAbstract Attribute */
20643 /************************/
20644 
20645 static UA_StatusCode
20646 readIsAbstractAttribute(const UA_Node *node, UA_Variant *v) {
20647  const UA_Boolean *isAbstract;
20648  switch(node->nodeClass) {
20650  isAbstract = &((const UA_ReferenceTypeNode*)node)->isAbstract;
20651  break;
20653  isAbstract = &((const UA_ObjectTypeNode*)node)->isAbstract;
20654  break;
20656  isAbstract = &((const UA_VariableTypeNode*)node)->isAbstract;
20657  break;
20658  case UA_NODECLASS_DATATYPE:
20659  isAbstract = &((const UA_DataTypeNode*)node)->isAbstract;
20660  break;
20661  default:
20663  }
20664  forceVariantSetScalar(v, isAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]);
20665  return UA_STATUSCODE_GOOD;
20666 }
20667 
20668 static UA_StatusCode
20669 writeIsAbstractAttribute(UA_Node *node, UA_Boolean value) {
20670  switch(node->nodeClass) {
20672  ((UA_ObjectTypeNode*)node)->isAbstract = value;
20673  break;
20675  ((UA_ReferenceTypeNode*)node)->isAbstract = value;
20676  break;
20678  ((UA_VariableTypeNode*)node)->isAbstract = value;
20679  break;
20680  case UA_NODECLASS_DATATYPE:
20681  ((UA_DataTypeNode*)node)->isAbstract = value;
20682  break;
20683  default:
20685  }
20686  return UA_STATUSCODE_GOOD;
20687 }
20688 
20689 /****************/
20690 /* Read Service */
20691 /****************/
20692 
20693 static const UA_String binEncoding = {sizeof("Default Binary")-1, (UA_Byte*)"Default Binary"};
20694 /* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */
20695 
20696 #define CHECK_NODECLASS(CLASS) \
20697  if(!(node->nodeClass & (CLASS))) { \
20698  retval = UA_STATUSCODE_BADATTRIBUTEIDINVALID; \
20699  break; \
20700  }
20701 
20702 void Service_Read_single(UA_Server *server, UA_Session *session,
20703  const UA_TimestampsToReturn timestamps,
20704  const UA_ReadValueId *id, UA_DataValue *v) {
20705  UA_LOG_DEBUG_SESSION(server->config.logger, session,
20706  "Read the attribute %i", id->attributeId);
20707 
20708  /* XML encoding is not supported */
20709  if(id->dataEncoding.name.length > 0 &&
20710  !UA_String_equal(&binEncoding, &id->dataEncoding.name)) {
20711  v->hasStatus = true;
20713  return;
20714  }
20715 
20716  /* Index range for an attribute other than value */
20717  if(id->indexRange.length > 0 && id->attributeId != UA_ATTRIBUTEID_VALUE) {
20718  v->hasStatus = true;
20720  return;
20721  }
20722 
20723  /* Get the node */
20724  const UA_Node *node = UA_NodeStore_get(server->nodestore, &id->nodeId);
20725  if(!node) {
20726  v->hasStatus = true;
20728  return;
20729  }
20730 
20731  /* Read the attribute */
20733  switch(id->attributeId) {
20734  case UA_ATTRIBUTEID_NODEID:
20735  forceVariantSetScalar(&v->value, &node->nodeId, &UA_TYPES[UA_TYPES_NODEID]);
20736  break;
20738  forceVariantSetScalar(&v->value, &node->nodeClass, &UA_TYPES[UA_TYPES_NODECLASS]);
20739  break;
20741  forceVariantSetScalar(&v->value, &node->browseName, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
20742  break;
20744  forceVariantSetScalar(&v->value, &node->displayName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20745  break;
20747  forceVariantSetScalar(&v->value, &node->description, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20748  break;
20750  forceVariantSetScalar(&v->value, &node->writeMask, &UA_TYPES[UA_TYPES_UINT32]);
20751  break;
20753  forceVariantSetScalar(&v->value, &node->userWriteMask, &UA_TYPES[UA_TYPES_UINT32]);
20754  break;
20756  retval = readIsAbstractAttribute(node, &v->value);
20757  break;
20760  forceVariantSetScalar(&v->value, &((const UA_ReferenceTypeNode*)node)->symmetric,
20762  break;
20765  forceVariantSetScalar(&v->value, &((const UA_ReferenceTypeNode*)node)->inverseName,
20766  &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20767  break;
20770  forceVariantSetScalar(&v->value, &((const UA_ViewNode*)node)->containsNoLoops,
20771  &UA_TYPES[UA_TYPES_BOOLEAN]);
20772  break;
20775  forceVariantSetScalar(&v->value, &((const UA_ViewNode*)node)->eventNotifier,
20777  break;
20778  case UA_ATTRIBUTEID_VALUE:
20780  retval = readValueAttributeComplete(server, (const UA_VariableNode*)node,
20781  timestamps, &id->indexRange, v);
20782  break;
20785  forceVariantSetScalar(&v->value, &((const UA_VariableTypeNode*)node)->dataType,
20786  &UA_TYPES[UA_TYPES_NODEID]);
20787  break;
20790  forceVariantSetScalar(&v->value, &((const UA_VariableTypeNode*)node)->valueRank,
20792  break;
20795  retval = readArrayDimensionsAttribute((const UA_VariableNode*)node, v);
20796  break;
20799  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->accessLevel,
20800  &UA_TYPES[UA_TYPES_BYTE]);
20801  break;
20804  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->userAccessLevel,
20805  &UA_TYPES[UA_TYPES_BYTE]);
20806  break;
20809  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->minimumSamplingInterval,
20811  break;
20814  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->historizing,
20815  &UA_TYPES[UA_TYPES_BOOLEAN]);
20816  break;
20819  forceVariantSetScalar(&v->value, &((const UA_MethodNode*)node)->executable,
20820  &UA_TYPES[UA_TYPES_BOOLEAN]);
20821  break;
20824  forceVariantSetScalar(&v->value, &((const UA_MethodNode*)node)->userExecutable,
20825  &UA_TYPES[UA_TYPES_BOOLEAN]);
20826  break;
20827  default:
20829  }
20830 
20831  /* Return error code when reading has failed */
20832  if(retval != UA_STATUSCODE_GOOD) {
20833  v->hasStatus = true;
20834  v->status = retval;
20835  return;
20836  }
20837 
20838  v->hasValue = true;
20839 
20840  /* Create server timestamp */
20841  if(timestamps == UA_TIMESTAMPSTORETURN_SERVER ||
20842  timestamps == UA_TIMESTAMPSTORETURN_BOTH) {
20844  v->hasServerTimestamp = true;
20845  }
20846 
20847  /* Handle source time stamp */
20848  if(id->attributeId == UA_ATTRIBUTEID_VALUE) {
20849  if (timestamps == UA_TIMESTAMPSTORETURN_SERVER ||
20850  timestamps == UA_TIMESTAMPSTORETURN_NEITHER) {
20851  v->hasSourceTimestamp = false;
20852  v->hasSourcePicoseconds = false;
20853  } else if(!v->hasSourceTimestamp) {
20855  v->hasSourceTimestamp = true;
20856  }
20857  }
20858 }
20859 
20860 void Service_Read(UA_Server *server, UA_Session *session,
20861  const UA_ReadRequest *request, UA_ReadResponse *response) {
20862  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing ReadRequest");
20863  if(request->nodesToReadSize <= 0) {
20865  return;
20866  }
20867 
20868  /* check if the timestampstoreturn is valid */
20871  return;
20872  }
20873 
20874  size_t size = request->nodesToReadSize;
20875  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_DATAVALUE]);
20876  if(!response->results) {
20878  return;
20879  }
20880  response->resultsSize = size;
20881 
20882  if(request->maxAge < 0) {
20884  return;
20885  }
20886 
20887  for(size_t i = 0;i < size;++i) {
20888  Service_Read_single(server, session, request->timestampsToReturn,
20889  &request->nodesToRead[i], &response->results[i]);
20890  }
20891 
20892 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
20893  /* Add an expiry header for caching */
20894  if(session->sessionId.namespaceIndex == 0 &&
20896  session->sessionId.identifier.numeric == 0){
20897  UA_ExtensionObject additionalHeader;
20898  UA_ExtensionObject_init(&additionalHeader);
20900  additionalHeader.content.encoded.typeId =UA_TYPES[UA_TYPES_VARIANT].typeId;
20901 
20902  UA_Variant variant;
20903  UA_Variant_init(&variant);
20904 
20905  UA_DateTime* expireArray = NULL;
20906  expireArray = UA_Array_new(request->nodesToReadSize,
20908  variant.data = expireArray;
20909 
20910  /* expires in 20 seconds */
20911  for(UA_UInt32 i = 0;i < response->resultsSize;++i) {
20912  expireArray[i] = UA_DateTime_now() + 20 * 100 * 1000 * 1000;
20913  }
20914  UA_Variant_setArray(&variant, expireArray, request->nodesToReadSize,
20915  &UA_TYPES[UA_TYPES_DATETIME]);
20916 
20917  size_t offset = 0;
20918  UA_ByteString str;
20919  size_t strlength = UA_calcSizeBinary(&variant, &UA_TYPES[UA_TYPES_VARIANT]);
20920  UA_ByteString_allocBuffer(&str, strlength);
20921  /* No chunking callback for the encoding */
20922  UA_StatusCode retval = UA_encodeBinary(&variant, &UA_TYPES[UA_TYPES_VARIANT],
20923  NULL, NULL, &str, &offset);
20924  UA_Array_delete(expireArray, request->nodesToReadSize, &UA_TYPES[UA_TYPES_DATETIME]);
20925  if(retval == UA_STATUSCODE_GOOD){
20926  additionalHeader.content.encoded.body.data = str.data;
20927  additionalHeader.content.encoded.body.length = offset;
20928  response->responseHeader.additionalHeader = additionalHeader;
20929  }
20930  }
20931 #endif
20932 }
20933 
20934 /* Exposes the Read service to local users */
20936 UA_Server_read(UA_Server *server, const UA_ReadValueId *item,
20937  UA_TimestampsToReturn timestamps) {
20938  UA_DataValue dv;
20939  UA_DataValue_init(&dv);
20940  UA_RCU_LOCK();
20941  Service_Read_single(server, &adminSession, timestamps, item, &dv);
20942  UA_RCU_UNLOCK();
20943  return dv;
20944 }
20945 
20946 /* Used in inline functions exposing the Read service with more syntactic sugar
20947  * for individual attributes */
20949 __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId,
20950  const UA_AttributeId attributeId, void *v) {
20951  /* Call the read service */
20952  UA_ReadValueId item;
20953  UA_ReadValueId_init(&item);
20954  item.nodeId = *nodeId;
20955  item.attributeId = attributeId;
20957 
20958  /* Check the return value */
20960  if(dv.hasStatus)
20961  retval = dv.status;
20962  else if(!dv.hasValue)
20964  if(retval != UA_STATUSCODE_GOOD) {
20965  UA_DataValue_deleteMembers(&dv);
20966  return retval;
20967  }
20968 
20969  /* Prepare the result */
20970  if(attributeId == UA_ATTRIBUTEID_VALUE ||
20971  attributeId == UA_ATTRIBUTEID_ARRAYDIMENSIONS) {
20972  /* Return the entire variant */
20974  retval = UA_Variant_copy(&dv.value, v);
20975  } else {
20976  /* storageType is UA_VARIANT_DATA. Copy the entire variant
20977  * (including pointers and all) */
20978  memcpy(v, &dv.value, sizeof(UA_Variant));
20979  }
20980  } else {
20981  /* Return the variant content only */
20983  retval = UA_copy(dv.value.data, v, dv.value.type);
20984  } else {
20985  /* storageType is UA_VARIANT_DATA. Copy the content of the type
20986  * (including pointers and all) */
20987  memcpy(v, dv.value.data, dv.value.type->memSize);
20988  /* Delete the "carrier" in the variant */
20989  UA_free(dv.value.data);
20990  }
20991  }
20992  return retval;
20993 }
20994 
20995 /*****************/
20996 /* Write Service */
20997 /*****************/
20998 
20999 #define CHECK_DATATYPE_SCALAR(EXP_DT) \
21000  if(!wvalue->value.hasValue || \
21001  &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \
21002  !UA_Variant_isScalar(&wvalue->value.value)) { \
21003  retval = UA_STATUSCODE_BADTYPEMISMATCH; \
21004  break; \
21005  }
21006 
21007 #define CHECK_DATATYPE_ARRAY(EXP_DT) \
21008  if(!wvalue->value.hasValue || \
21009  &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \
21010  UA_Variant_isScalar(&wvalue->value.value)) { \
21011  retval = UA_STATUSCODE_BADTYPEMISMATCH; \
21012  break; \
21013  }
21014 
21015 #define CHECK_NODECLASS_WRITE(CLASS) \
21016  if((node->nodeClass & (CLASS)) == 0) { \
21017  retval = UA_STATUSCODE_BADNODECLASSINVALID; \
21018  break; \
21019  }
21020 
21021 /* This function implements the main part of the write service and operates on a
21022  copy of the node (not in single-threaded mode). */
21023 static UA_StatusCode
21024 CopyAttributeIntoNode(UA_Server *server, UA_Session *session,
21025  UA_Node *node, const UA_WriteValue *wvalue) {
21026  const void *value = wvalue->value.value.data;
21028  switch(wvalue->attributeId) {
21029  case UA_ATTRIBUTEID_NODEID:
21032  break;
21034  CHECK_DATATYPE_SCALAR(QUALIFIEDNAME);
21035  UA_QualifiedName_deleteMembers(&node->browseName);
21036  UA_QualifiedName_copy(value, &node->browseName);
21037  break;
21039  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21040  UA_LocalizedText_deleteMembers(&node->displayName);
21041  UA_LocalizedText_copy(value, &node->displayName);
21042  break;
21044  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21045  UA_LocalizedText_deleteMembers(&node->description);
21046  UA_LocalizedText_copy(value, &node->description);
21047  break;
21049  CHECK_DATATYPE_SCALAR(UINT32);
21050  node->writeMask = *(const UA_UInt32*)value;
21051  break;
21053  CHECK_DATATYPE_SCALAR(UINT32);
21054  node->userWriteMask = *(const UA_UInt32*)value;
21055  break;
21057  CHECK_DATATYPE_SCALAR(BOOLEAN);
21058  retval = writeIsAbstractAttribute(node, *(const UA_Boolean*)value);
21059  break;
21062  CHECK_DATATYPE_SCALAR(BOOLEAN);
21063  ((UA_ReferenceTypeNode*)node)->symmetric = *(const UA_Boolean*)value;
21064  break;
21067  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21068  UA_LocalizedText_deleteMembers(&((UA_ReferenceTypeNode*)node)->inverseName);
21069  UA_LocalizedText_copy(value, &((UA_ReferenceTypeNode*)node)->inverseName);
21070  break;
21073  CHECK_DATATYPE_SCALAR(BOOLEAN);
21074  ((UA_ViewNode*)node)->containsNoLoops = *(const UA_Boolean*)value;
21075  break;
21078  CHECK_DATATYPE_SCALAR(BYTE);
21079  ((UA_ViewNode*)node)->eventNotifier = *(const UA_Byte*)value;
21080  break;
21081  case UA_ATTRIBUTEID_VALUE:
21083  retval = writeValueAttribute(server, (UA_VariableNode*)node,
21084  &wvalue->value, &wvalue->indexRange);
21085  break;
21088  CHECK_DATATYPE_SCALAR(NODEID);
21089  retval = writeDataTypeAttributeWithVT(server, (UA_VariableNode*)node, (const UA_NodeId*)value);
21090  break;
21093  CHECK_DATATYPE_SCALAR(INT32);
21094  retval = writeValueRankAttributeWithVT(server, (UA_VariableNode*)node, *(const UA_Int32*)value);
21095  break;
21098  CHECK_DATATYPE_ARRAY(UINT32);
21099  retval = writeArrayDimensionsAttribute(server, (UA_VariableNode*)node,
21100  wvalue->value.value.arrayLength,
21101  wvalue->value.value.data);
21102  break;
21105  CHECK_DATATYPE_SCALAR(BYTE);
21106  ((UA_VariableNode*)node)->accessLevel = *(const UA_Byte*)value;
21107  break;
21110  CHECK_DATATYPE_SCALAR(BYTE);
21111  ((UA_VariableNode*)node)->userAccessLevel = *(const UA_Byte*)value;
21112  break;
21115  CHECK_DATATYPE_SCALAR(DOUBLE);
21116  ((UA_VariableNode*)node)->minimumSamplingInterval = *(const UA_Double*)value;
21117  break;
21120  CHECK_DATATYPE_SCALAR(BOOLEAN);
21121  ((UA_VariableNode*)node)->historizing = *(const UA_Boolean*)value;
21122  break;
21125  CHECK_DATATYPE_SCALAR(BOOLEAN);
21126  ((UA_MethodNode*)node)->executable = *(const UA_Boolean*)value;
21127  break;
21130  CHECK_DATATYPE_SCALAR(BOOLEAN);
21131  ((UA_MethodNode*)node)->userExecutable = *(const UA_Boolean*)value;
21132  break;
21133  default:
21135  break;
21136  }
21137  if(retval != UA_STATUSCODE_GOOD)
21138  UA_LOG_INFO_SESSION(server->config.logger, session,
21139  "WriteRequest returned status code %s",
21140  UA_StatusCode_name(retval));
21141  return retval;
21142 }
21143 
21144 void
21145 Service_Write(UA_Server *server, UA_Session *session,
21146  const UA_WriteRequest *request, UA_WriteResponse *response) {
21147  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing WriteRequest");
21148  if(request->nodesToWriteSize <= 0) {
21150  return;
21151  }
21152 
21154  if(!response->results) {
21156  return;
21157  }
21158  response->resultsSize = request->nodesToWriteSize;
21159 
21160  for(size_t i = 0;i < request->nodesToWriteSize;++i) {
21161  response->results[i] = UA_Server_editNode(server, session, &request->nodesToWrite[i].nodeId,
21162  (UA_EditNodeCallback)CopyAttributeIntoNode,
21163  &request->nodesToWrite[i]);
21164  }
21165 }
21166 
21168 UA_Server_write(UA_Server *server, const UA_WriteValue *value) {
21169  UA_RCU_LOCK();
21170  UA_StatusCode retval =
21171  UA_Server_editNode(server, &adminSession, &value->nodeId,
21172  (UA_EditNodeCallback)CopyAttributeIntoNode, value);
21173  UA_RCU_UNLOCK();
21174  return retval;
21175 }
21176 
21177 /* Convenience function to be wrapped into inline functions */
21179 __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId,
21180  const UA_AttributeId attributeId,
21181  const UA_DataType *attr_type,
21182  const void *attr) {
21183  UA_WriteValue wvalue;
21184  UA_WriteValue_init(&wvalue);
21185  wvalue.nodeId = *nodeId;
21186  wvalue.attributeId = attributeId;
21187  wvalue.value.hasValue = true;
21188  if(attr_type != &UA_TYPES[UA_TYPES_VARIANT]) {
21189  /* hacked cast. the target WriteValue is used as const anyway */
21190  UA_Variant_setScalar(&wvalue.value.value, (void*)(uintptr_t)attr, attr_type);
21191  } else {
21192  wvalue.value.value = *(const UA_Variant*)attr;
21193  }
21194  return UA_Server_write(server, &wvalue);
21195 }
21196 
21197 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_nodemanagement.c" ***********************************/
21198 
21199 /* This Source Code Form is subject to the terms of the Mozilla Public
21200  * License, v. 2.0. If a copy of the MPL was not distributed with this
21201  * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
21202 
21203 
21204 /************************/
21205 /* Forward Declarations */
21206 /************************/
21207 
21208 static UA_StatusCode
21209 addReference(UA_Server *server, UA_Session *session,
21210  const UA_AddReferencesItem *item);
21211 
21212 static UA_StatusCode
21213 deleteReference(UA_Server *server, UA_Session *session,
21214  const UA_DeleteReferencesItem *item);
21215 
21216 static UA_StatusCode
21217 deleteNode(UA_Server *server, UA_Session *session,
21218  const UA_NodeId *nodeId, UA_Boolean deleteReferences);
21219 
21220 /**********************/
21221 /* Consistency Checks */
21222 /**********************/
21223 
21224 /* Check if the requested parent node exists, has the right node class and is
21225  * referenced with an allowed (hierarchical) reference type. For "type" nodes,
21226  * only hasSubType references are allowed. */
21227 static UA_StatusCode
21228 checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeClass,
21229  const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId) {
21230  /* Objects do not need a parent (e.g. mandatory/optional modellingrules) */
21231  if(nodeClass == UA_NODECLASS_OBJECT && UA_NodeId_isNull(parentNodeId) &&
21232  UA_NodeId_isNull(referenceTypeId))
21233  return UA_STATUSCODE_GOOD;
21234 
21235  /* See if the parent exists */
21236  const UA_Node *parent = UA_NodeStore_get(server->nodestore, parentNodeId);
21237  if(!parent) {
21238  UA_LOG_INFO_SESSION(server->config.logger, session,
21239  "AddNodes: Parent node not found");
21241  }
21242 
21243  /* Check the referencetype exists */
21244  const UA_ReferenceTypeNode *referenceType =
21245  (const UA_ReferenceTypeNode*)UA_NodeStore_get(server->nodestore, referenceTypeId);
21246  if(!referenceType) {
21247  UA_LOG_INFO_SESSION(server->config.logger, session,
21248  "AddNodes: Reference type to the parent not found");
21250  }
21251 
21252  /* Check if the referencetype is a reference type node */
21253  if(referenceType->nodeClass != UA_NODECLASS_REFERENCETYPE) {
21254  UA_LOG_INFO_SESSION(server->config.logger, session,
21255  "AddNodes: Reference type to the parent invalid");
21257  }
21258 
21259  /* Check that the reference type is not abstract */
21260  if(referenceType->isAbstract == true) {
21261  UA_LOG_INFO_SESSION(server->config.logger, session,
21262  "AddNodes: Abstract reference type to the parent not allowed");
21264  }
21265 
21266  /* Check hassubtype relation for type nodes */
21267  const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
21268  if(nodeClass == UA_NODECLASS_DATATYPE ||
21269  nodeClass == UA_NODECLASS_VARIABLETYPE ||
21270  nodeClass == UA_NODECLASS_OBJECTTYPE ||
21271  nodeClass == UA_NODECLASS_REFERENCETYPE) {
21272  /* type needs hassubtype reference to the supertype */
21273  if(!UA_NodeId_equal(referenceTypeId, &subtypeId)) {
21274  UA_LOG_INFO_SESSION(server->config.logger, session,
21275  "AddNodes: New type node need to have a "
21276  "HasSubType reference");
21278  }
21279  /* supertype needs to be of the same node type */
21280  if(parent->nodeClass != nodeClass) {
21281  UA_LOG_INFO_SESSION(server->config.logger, session,
21282  "AddNodes: New type node needs to be of the same "
21283  "node type as the parent");
21285  }
21286  return UA_STATUSCODE_GOOD;
21287  }
21288 
21289  /* Test if the referencetype is hierarchical */
21290  const UA_NodeId hierarchicalReference =
21291  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES);
21292  if(!isNodeInTree(server->nodestore, referenceTypeId,
21293  &hierarchicalReference, &subtypeId, 1)) {
21294  UA_LOG_INFO_SESSION(server->config.logger, session,
21295  "AddNodes: Reference type is not hierarchical");
21297  }
21298 
21299  return UA_STATUSCODE_GOOD;
21300 }
21301 
21302 /************/
21303 /* Add Node */
21304 /************/
21305 
21306 static void
21307 Service_AddNodes_single(UA_Server *server, UA_Session *session,
21308  const UA_AddNodesItem *item, UA_AddNodesResult *result,
21309  UA_InstantiationCallback *instantiationCallback);
21310 
21311 static UA_StatusCode
21312 copyChildNodesToNode(UA_Server *server, UA_Session *session,
21313  const UA_NodeId *sourceNodeId, const UA_NodeId *destinationNodeId,
21314  UA_InstantiationCallback *instantiationCallback);
21315 
21316 /* copy an existing variable under the given parent. then instantiate the
21317  * variable for its type */
21318 static UA_StatusCode
21319 copyExistingVariable(UA_Server *server, UA_Session *session, const UA_NodeId *variable,
21320  const UA_NodeId *referenceType, const UA_NodeId *parent,
21321  UA_InstantiationCallback *instantiationCallback) {
21322  const UA_VariableNode *node =
21323  (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, variable);
21324  if(!node)
21326  if(node->nodeClass != UA_NODECLASS_VARIABLE)
21328 
21329  /* Get the current value */
21330  UA_DataValue value;
21331  UA_DataValue_init(&value);
21332  UA_StatusCode retval = readValueAttribute(server, node, &value);
21333  if(retval != UA_STATUSCODE_GOOD)
21334  return retval;
21335 
21336  /* Prepare the variable description */
21337  UA_VariableAttributes attr;
21338  UA_VariableAttributes_init(&attr);
21339  attr.displayName = node->displayName;
21340  attr.description = node->description;
21341  attr.writeMask = node->writeMask;
21342  attr.userWriteMask = node->userWriteMask;
21343  attr.value = value.value;
21344  attr.dataType = node->dataType;
21345  attr.valueRank = node->valueRank;
21346  attr.arrayDimensionsSize = node->arrayDimensionsSize;
21347  attr.arrayDimensions = node->arrayDimensions;
21348  attr.accessLevel = node->accessLevel;
21349  attr.userAccessLevel = node->userAccessLevel;
21351  attr.historizing = node->historizing;
21352 
21353  UA_AddNodesItem item;
21354  UA_AddNodesItem_init(&item);
21356  item.parentNodeId.nodeId = *parent;
21357  item.referenceTypeId = *referenceType;
21358  item.browseName = node->browseName;
21361  item.nodeAttributes.content.decoded.data = &attr;
21362  const UA_VariableTypeNode *vt = (const UA_VariableTypeNode*)getNodeType(server, (const UA_Node*)node);
21363  if(!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE || vt->isAbstract) {
21365  goto cleanup;
21366  }
21367  item.typeDefinition.nodeId = vt->nodeId;
21368 
21369  /* Add the variable and instantiate the children */
21370  UA_AddNodesResult res;
21371  UA_AddNodesResult_init(&res);
21372  Service_AddNodes_single(server, session, &item, &res, instantiationCallback);
21373  if(res.statusCode != UA_STATUSCODE_GOOD) {
21374  retval = res.statusCode;
21375  goto cleanup;
21376  }
21377  retval = copyChildNodesToNode(server, session, &node->nodeId,
21378  &res.addedNodeId, instantiationCallback);
21379 
21380  if(retval == UA_STATUSCODE_GOOD && instantiationCallback)
21381  instantiationCallback->method(res.addedNodeId, node->nodeId,
21382  instantiationCallback->handle);
21383 
21384  UA_NodeId_deleteMembers(&res.addedNodeId);
21385  cleanup:
21386  if(value.hasValue && value.value.storageType == UA_VARIANT_DATA)
21387  UA_Variant_deleteMembers(&value.value);
21388  return retval;
21389 }
21390 
21391 /* Copy an existing object under the given parent. Then instantiate for all
21392  * hastypedefinitions of the original version. */
21393 static UA_StatusCode
21394 copyExistingObject(UA_Server *server, UA_Session *session, const UA_NodeId *object,
21395  const UA_NodeId *referenceType, const UA_NodeId *parent,
21396  UA_InstantiationCallback *instantiationCallback) {
21397  const UA_ObjectNode *node =
21398  (const UA_ObjectNode*)UA_NodeStore_get(server->nodestore, object);
21399  if(!node)
21401  if(node->nodeClass != UA_NODECLASS_OBJECT)
21403 
21404  /* Prepare the item */
21405  UA_ObjectAttributes attr;
21406  UA_ObjectAttributes_init(&attr);
21407  attr.displayName = node->displayName;
21408  attr.description = node->description;
21409  attr.writeMask = node->writeMask;
21410  attr.userWriteMask = node->userWriteMask;
21411  attr.eventNotifier = node->eventNotifier;
21412 
21413  UA_AddNodesItem item;
21414  UA_AddNodesItem_init(&item);
21416  item.parentNodeId.nodeId = *parent;
21417  item.referenceTypeId = *referenceType;
21418  item.browseName = node->browseName;
21421  item.nodeAttributes.content.decoded.data = &attr;
21422  const UA_ObjectTypeNode *objtype = (const UA_ObjectTypeNode*)getNodeType(server, (const UA_Node*)node);
21423  if(!objtype || objtype->nodeClass != UA_NODECLASS_OBJECTTYPE || objtype->isAbstract)
21425  item.typeDefinition.nodeId = objtype->nodeId;
21426 
21427  /* add the new object */
21428  UA_AddNodesResult res;
21429  UA_AddNodesResult_init(&res);
21430  Service_AddNodes_single(server, session, &item, &res, instantiationCallback);
21431  if(res.statusCode != UA_STATUSCODE_GOOD)
21432  return res.statusCode;
21433 
21434  /* Copy any aggregated/nested variables/methods/subobjects this object contains
21435  * These objects may not be part of the nodes type. */
21436  UA_StatusCode retval = copyChildNodesToNode(server, session, &node->nodeId,
21437  &res.addedNodeId, instantiationCallback);
21438  if(retval == UA_STATUSCODE_GOOD && instantiationCallback)
21439  instantiationCallback->method(res.addedNodeId, node->nodeId,
21440  instantiationCallback->handle);
21441 
21442  UA_NodeId_deleteMembers(&res.addedNodeId);
21443  return retval;
21444 }
21445 
21446 static UA_StatusCode
21447 setObjectInstanceHandle(UA_Server *server, UA_Session *session,
21448  UA_ObjectNode* node, void * (*constructor)(const UA_NodeId instance)) {
21449  if(node->nodeClass != UA_NODECLASS_OBJECT)
21451  if(!node->instanceHandle)
21452  node->instanceHandle = constructor(node->nodeId);
21453  return UA_STATUSCODE_GOOD;
21454 }
21455 
21456 static UA_StatusCode
21457 instantiateNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
21458  UA_NodeClass nodeClass, const UA_NodeId *typeId,
21459  UA_InstantiationCallback *instantiationCallback) {
21460  /* see if the type node is correct */
21461  const UA_Node *typenode = UA_NodeStore_get(server->nodestore, typeId);
21462  if(!typenode)
21464  if(nodeClass == UA_NODECLASS_VARIABLE) {
21465  if(typenode->nodeClass != UA_NODECLASS_VARIABLETYPE ||
21466  ((const UA_VariableTypeNode*)typenode)->isAbstract)
21468  } else if(nodeClass == UA_NODECLASS_OBJECT) {
21469  if(typenode->nodeClass != UA_NODECLASS_OBJECTTYPE ||
21470  ((const UA_ObjectTypeNode*)typenode)->isAbstract)
21472  } else {
21474  }
21475 
21476  /* Get the hierarchy of the type and all its supertypes */
21477  UA_NodeId *hierarchy = NULL;
21478  size_t hierarchySize = 0;
21479  UA_StatusCode retval =
21480  getTypeHierarchy(server->nodestore, typenode, true, &hierarchy, &hierarchySize);
21481  if(retval != UA_STATUSCODE_GOOD)
21482  return retval;
21483 
21484  /* Copy members of the type and supertypes */
21485  for(size_t i = 0; i < hierarchySize; ++i)
21486  retval |= copyChildNodesToNode(server, session, &hierarchy[i], nodeId, instantiationCallback);
21487  UA_Array_delete(hierarchy, hierarchySize, &UA_TYPES[UA_TYPES_NODEID]);
21488  if(retval != UA_STATUSCODE_GOOD)
21489  return retval;
21490 
21491  /* Call the object constructor */
21492  if(typenode->nodeClass == UA_NODECLASS_OBJECTTYPE) {
21493  const UA_ObjectLifecycleManagement *olm =
21494  &((const UA_ObjectTypeNode*)typenode)->lifecycleManagement;
21495  if(olm->constructor)
21496  UA_Server_editNode(server, session, nodeId,
21497  (UA_EditNodeCallback)setObjectInstanceHandle,
21498  olm->constructor);
21499  }
21500 
21501  /* Add a hasType reference */
21502  UA_AddReferencesItem addref;
21503  UA_AddReferencesItem_init(&addref);
21504  addref.sourceNodeId = *nodeId;
21505  addref.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
21506  addref.isForward = true;
21507  addref.targetNodeId.nodeId = *typeId;
21508  return addReference(server, session, &addref);
21509 }
21510 
21511 /* Search for an instance of "browseName" in node searchInstance
21512  * Used during copyChildNodes to find overwritable/mergable nodes */
21513 static UA_StatusCode
21514 instanceFindAggregateByBrowsename(UA_Server *server, UA_Session *session,
21515  const UA_NodeId *searchInstance,
21516  const UA_QualifiedName *browseName,
21517  UA_NodeId *outInstanceNodeId) {
21519  UA_BrowseDescription_init(&bd);
21520  bd.nodeId = *searchInstance;
21521  bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES);
21522  bd.includeSubtypes = true;
21526 
21527  UA_BrowseResult br;
21528  UA_BrowseResult_init(&br);
21529  Service_Browse_single(server, session, NULL, &bd, 0, &br);
21530  if(br.statusCode != UA_STATUSCODE_GOOD)
21531  return br.statusCode;
21532 
21534  for(size_t i = 0; i < br.referencesSize; ++i) {
21535  UA_ReferenceDescription *rd = &br.references[i];
21536  if(rd->browseName.namespaceIndex == browseName->namespaceIndex &&
21537  UA_String_equal(&rd->browseName.name, &browseName->name)) {
21538  retval = UA_NodeId_copy(&rd->nodeId.nodeId, outInstanceNodeId);
21539  break;
21540  }
21541  }
21542 
21543  UA_BrowseResult_deleteMembers(&br);
21544  return retval;
21545 }
21546 
21547 static UA_Boolean
21548 mandatoryChild(UA_Server *server, UA_Session *session, const UA_NodeId *childNodeId) {
21549  const UA_NodeId mandatoryId = UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULE_MANDATORY);
21550  const UA_NodeId hasModellingRuleId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE);
21551 
21552  /* Get the child */
21553  const UA_Node *child = UA_NodeStore_get(server->nodestore, childNodeId);
21554  if(!child)
21555  return false;
21556 
21557  /* Look for the reference making the child mandatory */
21558  for(size_t i = 0; i < child->referencesSize; ++i) {
21559  UA_ReferenceNode *ref = &child->references[i];
21560  if(!UA_NodeId_equal(&hasModellingRuleId, &ref->referenceTypeId))
21561  continue;
21562  if(!UA_NodeId_equal(&mandatoryId, &ref->targetId.nodeId))
21563  continue;
21564  if(ref->isInverse)
21565  continue;
21566  return true;
21567  }
21568  return false;
21569 }
21570 
21571 /* Copy any children of Node sourceNodeId to another node destinationNodeId
21572  * Used at 2 places:
21573  * (1) During instantiation, when any children of the Type are copied
21574  * (2) During instantiation to copy any *nested* instances to the new node
21575  * (2.1) Might call instantiation of a type first
21576  * (2.2) *Should* then overwrite nested contents in definition --> this scenario is currently not handled!
21577  */
21578 static UA_StatusCode
21579 copyChildNodesToNode(UA_Server* server, UA_Session* session,
21580  const UA_NodeId* sourceNodeId, const UA_NodeId* destinationNodeId,
21581  UA_InstantiationCallback* instantiationCallback) {
21582  /* Browse to get all children */
21584  UA_BrowseDescription_init(&bd);
21585  bd.nodeId = *sourceNodeId;
21586  bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES);
21587  bd.includeSubtypes = true;
21592 
21593  UA_BrowseResult br;
21594  UA_BrowseResult_init(&br);
21595  Service_Browse_single(server, session, NULL, &bd, 0, &br);
21596  if(br.statusCode != UA_STATUSCODE_GOOD)
21597  return br.statusCode;
21598 
21599  /* Copy all children */
21601  UA_NodeId existingChild = UA_NODEID_NULL;
21602  for(size_t i = 0; i < br.referencesSize; ++i) {
21603  UA_ReferenceDescription *rd = &br.references[i];
21604 
21605  /* Is the child mandatory? If not, skip */
21606  if(!mandatoryChild(server, session, &rd->nodeId.nodeId))
21607  continue;
21608 
21609  /* TODO: If a child is optional, check whether optional children that
21610  * were manually added fit the constraints. */
21611 
21612  /* Check for deduplication */
21613  retval = instanceFindAggregateByBrowsename(server, session, destinationNodeId,
21614  &rd->browseName, &existingChild);
21615  if(retval != UA_STATUSCODE_GOOD)
21616  break;
21617 
21618  if(UA_NodeId_equal(&UA_NODEID_NULL, &existingChild)) {
21619  /* New node in child */
21620  if(rd->nodeClass == UA_NODECLASS_METHOD) {
21621  /* add a reference to the method in the objecttype */
21622  UA_AddReferencesItem newItem;
21623  UA_AddReferencesItem_init(&newItem);
21624  newItem.sourceNodeId = *destinationNodeId;
21625  newItem.referenceTypeId = rd->referenceTypeId;
21626  newItem.isForward = true;
21627  newItem.targetNodeId = rd->nodeId;
21629  retval = addReference(server, session, &newItem);
21630  } else if(rd->nodeClass == UA_NODECLASS_VARIABLE)
21631  retval = copyExistingVariable(server, session, &rd->nodeId.nodeId,
21632  &rd->referenceTypeId, destinationNodeId,
21633  instantiationCallback);
21634  else if(rd->nodeClass == UA_NODECLASS_OBJECT)
21635  retval = copyExistingObject(server, session, &rd->nodeId.nodeId,
21636  &rd->referenceTypeId, destinationNodeId,
21637  instantiationCallback);
21638  } else {
21639  /* Preexistent node in child
21640  * General strategy if we meet an already existing node:
21641  * - Preexistent variable contents always 'win' overwriting anything
21642  * supertypes would instantiate
21643  * - Always copy contents of template *into* existant node (merge
21644  * contents of e.g. Folders like ParameterSet) */
21645  if(rd->nodeClass == UA_NODECLASS_METHOD) {
21646  /* Do nothing, existent method wins */
21647  } else if(rd->nodeClass == UA_NODECLASS_VARIABLE ||
21648  rd->nodeClass == UA_NODECLASS_OBJECT) {
21649  if(!UA_NodeId_equal(&rd->nodeId.nodeId, &existingChild))
21650  retval = copyChildNodesToNode(server, session, &rd->nodeId.nodeId,
21651  &existingChild, instantiationCallback);
21652  }
21653  UA_NodeId_deleteMembers(&existingChild);
21654  }
21655  if(retval != UA_STATUSCODE_GOOD)
21656  break;
21657  }
21658  UA_BrowseResult_deleteMembers(&br);
21659  return retval;
21660 }
21661 
21663 Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node,
21664  const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId,
21665  const UA_NodeId *typeDefinition,
21666  UA_InstantiationCallback *instantiationCallback,
21667  UA_NodeId *addedNodeId) {
21669 
21670  /* Check the namespaceindex */
21671  if(node->nodeId.namespaceIndex >= server->namespacesSize) {
21672  UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Namespace invalid");
21675  }
21676 
21677  /* Check the reference to the parent */
21678  UA_StatusCode retval = checkParentReference(server, session, node->nodeClass,
21679  parentNodeId, referenceTypeId);
21680  if(retval != UA_STATUSCODE_GOOD) {
21681  UA_LOG_INFO_SESSION(server->config.logger, session,
21682  "AddNodes: Checking the reference to the parent returned "
21683  "error code %s", UA_StatusCode_name(retval));
21685  return retval;
21686  }
21687 
21688  /* Add the node to the nodestore */
21689  retval = UA_NodeStore_insert(server->nodestore, node);
21690  if(retval != UA_STATUSCODE_GOOD) {
21691  UA_LOG_INFO_SESSION(server->config.logger, session,
21692  "AddNodes: Node could not be added to the nodestore "
21693  "with error code %s", UA_StatusCode_name(retval));
21694  return retval;
21695  }
21696 
21697  /* Copy the nodeid if needed */
21698  if(addedNodeId) {
21699  retval = UA_NodeId_copy(&node->nodeId, addedNodeId);
21700  if(retval != UA_STATUSCODE_GOOD) {
21701  UA_LOG_INFO_SESSION(server->config.logger, session,
21702  "AddNodes: Could not copy the nodeid");
21703  goto remove_node;
21704  }
21705  }
21706 
21707  /* Hierarchical reference back to the parent */
21708  if(!UA_NodeId_isNull(parentNodeId)) {
21709  UA_AddReferencesItem item;
21710  UA_AddReferencesItem_init(&item);
21711  item.sourceNodeId = node->nodeId;
21712  item.referenceTypeId = *referenceTypeId;
21713  item.isForward = false;
21714  item.targetNodeId.nodeId = *parentNodeId;
21715  retval = addReference(server, session, &item);
21716  if(retval != UA_STATUSCODE_GOOD) {
21717  UA_LOG_INFO_SESSION(server->config.logger, session,
21718  "AddNodes: Could not add the reference to the parent"
21719  "with error code %s", UA_StatusCode_name(retval));
21720  goto remove_node;
21721  }
21722  }
21723 
21724  /* Fall back to a default typedefinition for variables and objects */
21725  const UA_NodeId basedatavariabletype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
21726  const UA_NodeId baseobjecttype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE);
21727  if(node->nodeClass == UA_NODECLASS_VARIABLE ||
21728  node->nodeClass == UA_NODECLASS_OBJECT) {
21729  if(!typeDefinition || UA_NodeId_isNull(typeDefinition)) {
21730  if(node->nodeClass == UA_NODECLASS_VARIABLE)
21731  typeDefinition = &basedatavariabletype;
21732  else
21733  typeDefinition = &baseobjecttype;
21734  }
21735 
21736  /* Instantiate variables and objects */
21737  retval = instantiateNode(server, session, &node->nodeId, node->nodeClass,
21738  typeDefinition, instantiationCallback);
21739  if(retval != UA_STATUSCODE_GOOD) {
21740  UA_LOG_INFO_SESSION(server->config.logger, session,
21741  "AddNodes: Could not instantiate the node with"
21742  "error code %s", UA_StatusCode_name(retval));
21743  goto remove_node;
21744  }
21745  }
21746 
21747  /* Custom callback */
21748  if(instantiationCallback)
21749  instantiationCallback->method(node->nodeId, *typeDefinition,
21750  instantiationCallback->handle);
21751  return UA_STATUSCODE_GOOD;
21752 
21753  remove_node:
21754  deleteNode(server, &adminSession, &node->nodeId, true);
21755  return retval;
21756 }
21757 
21758 /*******************************************/
21759 /* Create nodes from attribute description */
21760 /*******************************************/
21761 
21762 static UA_StatusCode
21763 copyStandardAttributes(UA_Node *node, const UA_AddNodesItem *item,
21764  const UA_NodeAttributes *attr) {
21765  UA_StatusCode retval;
21766  retval = UA_NodeId_copy(&item->requestedNewNodeId.nodeId, &node->nodeId);
21767  retval |= UA_QualifiedName_copy(&item->browseName, &node->browseName);
21768  retval |= UA_LocalizedText_copy(&attr->displayName, &node->displayName);
21769  retval |= UA_LocalizedText_copy(&attr->description, &node->description);
21770  node->writeMask = attr->writeMask;
21771  node->userWriteMask = attr->userWriteMask;
21772  return retval;
21773 }
21774 
21775 static UA_StatusCode
21776 copyCommonVariableAttributes(UA_Server *server, UA_VariableNode *node,
21777  const UA_AddNodesItem *item,
21778  const UA_VariableAttributes *attr) {
21779  const UA_NodeId basevartype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE);
21780  const UA_NodeId basedatavartype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
21781  const UA_NodeId *typeDef = &item->typeDefinition.nodeId;
21782  if(UA_NodeId_isNull(typeDef)) /* workaround when the variabletype is undefined */
21783  typeDef = &basedatavartype;
21784 
21785  /* Make sure we can instantiate the basetypes themselves */
21787  if(UA_NodeId_equal(&node->nodeId, &basevartype) ||
21788  UA_NodeId_equal(&node->nodeId, &basedatavartype)) {
21789  node->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
21790  node->valueRank = -2;
21791  return retval;
21792  }
21793 
21794  const UA_VariableTypeNode *vt =
21795  (const UA_VariableTypeNode*)UA_NodeStore_get(server->nodestore, typeDef);
21796  if(!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE)
21798  if(node->nodeClass == UA_NODECLASS_VARIABLE && vt->isAbstract)
21800 
21801  /* Set the datatype */
21802  if(!UA_NodeId_isNull(&attr->dataType))
21803  retval = writeDataTypeAttribute(server, node, &attr->dataType, &vt->dataType);
21804  else /* workaround common error where the datatype is left as NA_NODEID_NULL */
21805  retval = UA_NodeId_copy(&vt->dataType, &node->dataType);
21806  if(retval != UA_STATUSCODE_GOOD)
21807  return retval;
21808 
21809  /* Set the array dimensions. Check only against the vt. */
21810  retval = compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions,
21811  attr->arrayDimensionsSize, attr->arrayDimensions);
21812  if(retval == UA_STATUSCODE_GOOD) {
21813  retval = UA_Array_copy(attr->arrayDimensions, attr->arrayDimensionsSize,
21814  (void**)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]);
21815  }
21816  if(retval != UA_STATUSCODE_GOOD) {
21817  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21818  "Array dimensions incompatible with the VariableType "
21819  "with error code %s", UA_StatusCode_name(retval));
21820  return retval;
21821  }
21822  node->arrayDimensionsSize = attr->arrayDimensionsSize;
21823 
21824  /* Set the valuerank */
21825  if(attr->valueRank != 0 || !UA_Variant_isScalar(&attr->value))
21826  retval = writeValueRankAttribute(server, node, attr->valueRank, vt->valueRank);
21827  else /* workaround common error where the valuerank is left as 0 */
21828  node->valueRank = vt->valueRank;
21829  if(retval != UA_STATUSCODE_GOOD) {
21830  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21831  "Value Rank incompatible with the VariableType "
21832  "with error code %s", UA_StatusCode_name(retval));
21833  return retval;
21834  }
21835 
21836  /* Set the value */
21837  UA_DataValue value;
21838  UA_DataValue_init(&value);
21839  value.hasValue = true;
21840  value.value = attr->value;
21842 
21843  /* Use the default value from the vt if none is defined */
21844  if(!value.value.type) {
21845  retval = readValueAttribute(server, (const UA_VariableNode*)vt, &value);
21846  if(retval != UA_STATUSCODE_GOOD) {
21847  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21848  "Could not read the value of the variable type "
21849  "with error code %s", UA_StatusCode_name(retval));
21850  return retval;
21851  }
21852  }
21853 
21854  /* Write the value to the node */
21855  retval = writeValueAttribute(server, node, &value, NULL);
21856  if(retval != UA_STATUSCODE_GOOD) {
21857  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21858  "Could not set the value of the new node "
21859  "with error code %s", UA_StatusCode_name(retval));
21860  }
21861  UA_DataValue_deleteMembers(&value);
21862  return retval;
21863 }
21864 
21865 static UA_StatusCode
21866 copyVariableNodeAttributes(UA_Server *server, UA_VariableNode *vnode,
21867  const UA_AddNodesItem *item,
21868  const UA_VariableAttributes *attr) {
21869  vnode->accessLevel = attr->accessLevel;
21870  vnode->userAccessLevel = attr->userAccessLevel;
21871  vnode->historizing = attr->historizing;
21873  return copyCommonVariableAttributes(server, vnode, item, attr);
21874 }
21875 
21876 static UA_StatusCode
21877 copyVariableTypeNodeAttributes(UA_Server *server, UA_VariableTypeNode *vtnode,
21878  const UA_AddNodesItem *item,
21879  const UA_VariableTypeAttributes *attr) {
21880  vtnode->isAbstract = attr->isAbstract;
21881  return copyCommonVariableAttributes(server, (UA_VariableNode*)vtnode, item,
21882  (const UA_VariableAttributes*)attr);
21883 }
21884 
21885 static UA_StatusCode
21886 copyObjectNodeAttributes(UA_ObjectNode *onode, const UA_ObjectAttributes *attr) {
21887  onode->eventNotifier = attr->eventNotifier;
21888  return UA_STATUSCODE_GOOD;
21889 }
21890 
21891 static UA_StatusCode
21892 copyReferenceTypeNodeAttributes(UA_ReferenceTypeNode *rtnode,
21893  const UA_ReferenceTypeAttributes *attr) {
21894  rtnode->isAbstract = attr->isAbstract;
21895  rtnode->symmetric = attr->symmetric;
21896  return UA_LocalizedText_copy(&attr->inverseName, &rtnode->inverseName);
21897 }
21898 
21899 static UA_StatusCode
21900 copyObjectTypeNodeAttributes(UA_ObjectTypeNode *otnode,
21901  const UA_ObjectTypeAttributes *attr) {
21902  otnode->isAbstract = attr->isAbstract;
21903  return UA_STATUSCODE_GOOD;
21904 }
21905 
21906 static UA_StatusCode
21907 copyViewNodeAttributes(UA_ViewNode *vnode, const UA_ViewAttributes *attr) {
21908  vnode->containsNoLoops = attr->containsNoLoops;
21909  vnode->eventNotifier = attr->eventNotifier;
21910  return UA_STATUSCODE_GOOD;
21911 }
21912 
21913 static UA_StatusCode
21914 copyDataTypeNodeAttributes(UA_DataTypeNode *dtnode,
21915  const UA_DataTypeAttributes *attr) {
21916  dtnode->isAbstract = attr->isAbstract;
21917  return UA_STATUSCODE_GOOD;
21918 }
21919 
21920 #define CHECK_ATTRIBUTES(TYPE) \
21921  if(item->nodeAttributes.content.decoded.type != &UA_TYPES[UA_TYPES_##TYPE]) { \
21922  retval = UA_STATUSCODE_BADNODEATTRIBUTESINVALID; \
21923  break; \
21924  }
21925 
21926 static UA_StatusCode
21927 createNodeFromAttributes(UA_Server *server, const UA_AddNodesItem *item, UA_Node **newNode) {
21928  /* Check that we can read the attributes */
21930  !item->nodeAttributes.content.decoded.type)
21932 
21933  /* Create the node */
21934  // todo: error case where the nodeclass is faulty
21935  void *node = UA_NodeStore_newNode(item->nodeClass);
21936  if(!node)
21938 
21939  /* Copy the attributes into the node */
21940  void *data = item->nodeAttributes.content.decoded.data;
21941  UA_StatusCode retval = copyStandardAttributes(node, item, data);
21942  switch(item->nodeClass) {
21943  case UA_NODECLASS_OBJECT:
21944  CHECK_ATTRIBUTES(OBJECTATTRIBUTES);
21945  retval |= copyObjectNodeAttributes(node, data);
21946  break;
21947  case UA_NODECLASS_VARIABLE:
21948  CHECK_ATTRIBUTES(VARIABLEATTRIBUTES);
21949  retval |= copyVariableNodeAttributes(server, node, item, data);
21950  break;
21952  CHECK_ATTRIBUTES(OBJECTTYPEATTRIBUTES);
21953  retval |= copyObjectTypeNodeAttributes(node, data);
21954  break;
21956  CHECK_ATTRIBUTES(VARIABLETYPEATTRIBUTES);
21957  retval |= copyVariableTypeNodeAttributes(server, node, item, data);
21958  break;
21960  CHECK_ATTRIBUTES(REFERENCETYPEATTRIBUTES);
21961  retval |= copyReferenceTypeNodeAttributes(node, data);
21962  break;
21963  case UA_NODECLASS_DATATYPE:
21964  CHECK_ATTRIBUTES(DATATYPEATTRIBUTES);
21965  retval |= copyDataTypeNodeAttributes(node, data);
21966  break;
21967  case UA_NODECLASS_VIEW:
21968  CHECK_ATTRIBUTES(VIEWATTRIBUTES);
21969  retval |= copyViewNodeAttributes(node, data);
21970  break;
21971  case UA_NODECLASS_METHOD:
21973  default:
21975  }
21976 
21977  if(retval == UA_STATUSCODE_GOOD)
21978  *newNode = node;
21979  else
21981  return retval;
21982 }
21983 
21984 static void
21985 Service_AddNodes_single(UA_Server *server, UA_Session *session,
21986  const UA_AddNodesItem *item, UA_AddNodesResult *result,
21987  UA_InstantiationCallback *instantiationCallback) {
21988  /* Create the node from the attributes*/
21989  UA_Node *node = NULL;
21990  result->statusCode = createNodeFromAttributes(server, item, &node);
21991  if(result->statusCode != UA_STATUSCODE_GOOD) {
21992  UA_LOG_INFO_SESSION(server->config.logger, session,
21993  "Could not add node with error code %s",
21994  UA_StatusCode_name(result->statusCode));
21995  return;
21996  }
21997 
21998  /* Run consistency checks and add the node */
21999  UA_assert(node != NULL);
22000  result->statusCode = Service_AddNodes_existing(server, session, node, &item->parentNodeId.nodeId,
22001  &item->referenceTypeId, &item->typeDefinition.nodeId,
22002  instantiationCallback, &result->addedNodeId);
22003  if(result->statusCode != UA_STATUSCODE_GOOD) {
22004  UA_LOG_INFO_SESSION(server->config.logger, session,
22005  "Could not add node with error code %s",
22006  UA_StatusCode_name(result->statusCode));
22007  }
22008 }
22009 
22010 void Service_AddNodes(UA_Server *server, UA_Session *session,
22011  const UA_AddNodesRequest *request,
22012  UA_AddNodesResponse *response) {
22013  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing AddNodesRequest");
22014  if(request->nodesToAddSize <= 0) {
22016  return;
22017  }
22018  size_t size = request->nodesToAddSize;
22019 
22021  if(!response->results) {
22023  return;
22024  }
22025 
22026 
22027  response->resultsSize = size;
22028  for(size_t i = 0; i < size; ++i) {
22029  Service_AddNodes_single(server, session, &request->nodesToAdd[i],
22030  &response->results[i], NULL);
22031  }
22032 }
22033 
22035 __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass,
22036  const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
22037  const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
22038  const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
22039  const UA_DataType *attributeType,
22040  UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId) {
22041  /* prepare the item */
22042  UA_AddNodesItem item;
22043  UA_AddNodesItem_init(&item);
22044  item.parentNodeId.nodeId = parentNodeId;
22045  item.referenceTypeId = referenceTypeId;
22046  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22047  item.browseName = browseName;
22048  item.nodeClass = nodeClass;
22049  item.typeDefinition.nodeId = typeDefinition;
22052  .content.decoded = {attributeType, (void*)(uintptr_t)attr}};
22053 
22054  /* run the service */
22055  UA_AddNodesResult result;
22056  UA_AddNodesResult_init(&result);
22057  UA_RCU_LOCK();
22058  Service_AddNodes_single(server, &adminSession, &item, &result, instantiationCallback);
22059  UA_RCU_UNLOCK();
22060 
22061  /* prepare the output */
22062  if(outNewNodeId && result.statusCode == UA_STATUSCODE_GOOD)
22063  *outNewNodeId = result.addedNodeId;
22064  else
22065  UA_NodeId_deleteMembers(&result.addedNodeId);
22066  return result.statusCode;
22067 }
22068 
22069 /**************************************************/
22070 /* Add Special Nodes (not possible over the wire) */
22071 /**************************************************/
22072 
22074 UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
22075  const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
22076  const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
22077  const UA_VariableAttributes attr, const UA_DataSource dataSource,
22078  UA_NodeId *outNewNodeId) {
22079  /* Create the new node */
22080  UA_VariableNode *node = UA_NodeStore_newVariableNode();
22081  if(!node)
22083 
22084  /* Read the current value (to do typechecking) */
22086  UA_VariableAttributes editAttr = attr;
22087  UA_DataValue value;
22088  UA_DataValue_init(&value);
22089  if(dataSource.read)
22090  retval = dataSource.read(dataSource.handle, requestedNewNodeId,
22091  false, NULL, &value);
22092  else
22094  editAttr.value = value.value;
22095 
22096  if(retval != UA_STATUSCODE_GOOD) {
22097  UA_NodeStore_deleteNode((UA_Node*)node);
22098  return retval;
22099  }
22100 
22101  /* Copy attributes into node */
22102  UA_RCU_LOCK();
22103  UA_AddNodesItem item;
22104  UA_AddNodesItem_init(&item);
22105  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22106  item.browseName = browseName;
22107  item.typeDefinition.nodeId = typeDefinition;
22108  item.parentNodeId.nodeId = parentNodeId;
22109  retval |= copyStandardAttributes((UA_Node*)node, &item, (const UA_NodeAttributes*)&editAttr);
22110  retval |= copyVariableNodeAttributes(server, node, &item, &editAttr);
22111  UA_DataValue_deleteMembers(&node->value.data.value);
22112  node->valueSource = UA_VALUESOURCE_DATASOURCE;
22113  node->value.dataSource = dataSource;
22114  UA_DataValue_deleteMembers(&value);
22115  if(retval != UA_STATUSCODE_GOOD) {
22116  UA_NodeStore_deleteNode((UA_Node*)node);
22117  UA_RCU_UNLOCK();
22118  return retval;
22119  }
22120 
22121  /* Add the node */
22122  UA_AddNodesResult result;
22123  UA_AddNodesResult_init(&result);
22124  retval = Service_AddNodes_existing(server, &adminSession, (UA_Node*)node, &parentNodeId,
22125  &referenceTypeId, &typeDefinition, NULL, outNewNodeId);
22126  UA_RCU_UNLOCK();
22127  return retval;
22128 }
22129 
22130 #ifdef UA_ENABLE_METHODCALLS
22131 
22133 UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
22134  const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
22135  const UA_QualifiedName browseName, const UA_MethodAttributes attr,
22136  UA_MethodCallback method, void *handle,
22137  size_t inputArgumentsSize, const UA_Argument* inputArguments,
22138  size_t outputArgumentsSize, const UA_Argument* outputArguments,
22139  UA_NodeId *outNewNodeId) {
22141  if(!node)
22143 
22144  UA_AddNodesItem item;
22145  UA_AddNodesItem_init(&item);
22146  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22147  item.browseName = browseName;
22148  copyStandardAttributes((UA_Node*)node, &item, (const UA_NodeAttributes*)&attr);
22149  node->executable = attr.executable;
22150  node->userExecutable = attr.userExecutable;
22151  node->attachedMethod = method;
22152  node->methodHandle = handle;
22153 
22154  /* Add the node */
22155  UA_NodeId newMethodId;
22156  UA_NodeId_init(&newMethodId);
22157  UA_RCU_LOCK();
22158  UA_StatusCode retval = Service_AddNodes_existing(server, &adminSession, (UA_Node*)node, &parentNodeId,
22159  &referenceTypeId, &UA_NODEID_NULL, NULL, &newMethodId);
22160  UA_RCU_UNLOCK();
22161  if(retval != UA_STATUSCODE_GOOD)
22162  return retval;
22163 
22164  const UA_NodeId hasproperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
22165  const UA_NodeId propertytype = UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE);
22166 
22167  if(inputArgumentsSize > 0) {
22168  UA_VariableNode *inputArgumentsVariableNode = UA_NodeStore_newVariableNode();
22169  inputArgumentsVariableNode->nodeId.namespaceIndex = newMethodId.namespaceIndex;
22170  inputArgumentsVariableNode->browseName = UA_QUALIFIEDNAME_ALLOC(0, "InputArguments");
22171  inputArgumentsVariableNode->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", "InputArguments");
22172  inputArgumentsVariableNode->description = UA_LOCALIZEDTEXT_ALLOC("en_US", "InputArguments");
22173  inputArgumentsVariableNode->valueRank = 1;
22174 
22175  /* UAExpert creates a monitoreditem on inputarguments ... */
22176  inputArgumentsVariableNode->minimumSamplingInterval = 10000.0f;
22177 
22178  //TODO: 0.3 work item: the addMethodNode API does not have the possibility to set nodeIDs
22179  //actually we need to change the signature to pass UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS
22180  //and UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS into the function :/
22181  if(newMethodId.namespaceIndex == 0 &&
22182  newMethodId.identifierType == UA_NODEIDTYPE_NUMERIC &&
22184  inputArgumentsVariableNode->nodeId =
22186  }
22187  UA_Variant_setArrayCopy(&inputArgumentsVariableNode->value.data.value.value,
22188  inputArguments, inputArgumentsSize,
22190  inputArgumentsVariableNode->value.data.value.hasValue = true;
22191  UA_RCU_LOCK();
22192  // todo: check if adding succeeded
22193  Service_AddNodes_existing(server, &adminSession, (UA_Node*)inputArgumentsVariableNode,
22194  &newMethodId, &hasproperty, &propertytype, NULL, NULL);
22195  UA_RCU_UNLOCK();
22196  }
22197 
22198  if(outputArgumentsSize > 0) {
22199  /* create OutputArguments */
22200  UA_VariableNode *outputArgumentsVariableNode = UA_NodeStore_newVariableNode();
22201  outputArgumentsVariableNode->nodeId.namespaceIndex = newMethodId.namespaceIndex;
22202  outputArgumentsVariableNode->browseName = UA_QUALIFIEDNAME_ALLOC(0, "OutputArguments");
22203  outputArgumentsVariableNode->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OutputArguments");
22204  outputArgumentsVariableNode->description = UA_LOCALIZEDTEXT_ALLOC("en_US", "OutputArguments");
22205  outputArgumentsVariableNode->valueRank = 1;
22206  //FIXME: comment in line 882
22207  if(newMethodId.namespaceIndex == 0 &&
22208  newMethodId.identifierType == UA_NODEIDTYPE_NUMERIC &&
22210  outputArgumentsVariableNode->nodeId =
22212  }
22213  UA_Variant_setArrayCopy(&outputArgumentsVariableNode->value.data.value.value,
22214  outputArguments, outputArgumentsSize,
22216  outputArgumentsVariableNode->value.data.value.hasValue = true;
22217  UA_RCU_LOCK();
22218  // todo: check if adding succeeded
22219  Service_AddNodes_existing(server, &adminSession, (UA_Node*)outputArgumentsVariableNode,
22220  &newMethodId, &hasproperty, &propertytype, NULL, NULL);
22221  UA_RCU_UNLOCK();
22222  }
22223 
22224  if(outNewNodeId)
22225  *outNewNodeId = newMethodId;
22226  else
22227  UA_NodeId_deleteMembers(&newMethodId);
22228  return retval;
22229 }
22230 
22231 #endif
22232 
22233 /******************/
22234 /* Add References */
22235 /******************/
22236 
22237 static UA_StatusCode
22238 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
22239  const UA_DeleteReferencesItem *item);
22240 
22241 /* Adds a one-way reference to the local nodestore */
22242 static UA_StatusCode
22243 addOneWayReference(UA_Server *server, UA_Session *session,
22244  UA_Node *node, const UA_AddReferencesItem *item) {
22245  size_t i = node->referencesSize;
22246  size_t refssize = (i+1) | 3; // so the realloc is not necessary every time
22247  UA_ReferenceNode *new_refs = UA_realloc(node->references, sizeof(UA_ReferenceNode) * refssize);
22248  if(!new_refs)
22250  node->references = new_refs;
22251  UA_ReferenceNode_init(&new_refs[i]);
22252  UA_StatusCode retval = UA_NodeId_copy(&item->referenceTypeId, &new_refs[i].referenceTypeId);
22253  retval |= UA_ExpandedNodeId_copy(&item->targetNodeId, &new_refs[i].targetId);
22254  new_refs[i].isInverse = !item->isForward;
22255  if(retval == UA_STATUSCODE_GOOD)
22256  node->referencesSize = i+1;
22257  else
22258  UA_ReferenceNode_deleteMembers(&new_refs[i]);
22259  return retval;
22260 }
22261 
22262 static UA_StatusCode
22263 addReference(UA_Server *server, UA_Session *session,
22264  const UA_AddReferencesItem *item) {
22265  /* Currently no expandednodeids are allowed */
22266  if(item->targetServerUri.length > 0)
22268 
22269  /* Add the first direction */
22270  UA_StatusCode retval = UA_Server_editNode(server, session, &item->sourceNodeId,
22271  (UA_EditNodeCallback)addOneWayReference,
22272  item);
22273 
22274 
22275  if(retval != UA_STATUSCODE_GOOD)
22276  return retval;
22277 
22278  /* Add the second direction */
22279  UA_AddReferencesItem secondItem;
22280  UA_AddReferencesItem_init(&secondItem);
22281  secondItem.sourceNodeId = item->targetNodeId.nodeId;
22282  secondItem.referenceTypeId = item->referenceTypeId;
22283  secondItem.isForward = !item->isForward;
22284  secondItem.targetNodeId.nodeId = item->sourceNodeId;
22285  /* keep default secondItem.targetNodeClass = UA_NODECLASS_UNSPECIFIED */
22286 
22287  retval = UA_Server_editNode(server, session, &secondItem.sourceNodeId,
22288  (UA_EditNodeCallback)addOneWayReference, &secondItem);
22289 
22290  /* remove reference if the second direction failed */
22291  if(retval != UA_STATUSCODE_GOOD) {
22292  UA_DeleteReferencesItem deleteItem;
22293  deleteItem.sourceNodeId = item->sourceNodeId;
22294  deleteItem.referenceTypeId = item->referenceTypeId;
22295  deleteItem.isForward = item->isForward;
22296  deleteItem.targetNodeId = item->targetNodeId;
22297  deleteItem.deleteBidirectional = false;
22298  /* ignore returned status code */
22299  UA_Server_editNode(server, session, &item->sourceNodeId,
22300  (UA_EditNodeCallback)deleteOneWayReference, &deleteItem);
22301  }
22302  return retval;
22303 }
22304 
22305 void Service_AddReferences(UA_Server *server, UA_Session *session,
22306  const UA_AddReferencesRequest *request,
22307  UA_AddReferencesResponse *response) {
22308  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22309  "Processing AddReferencesRequest");
22310  if(request->referencesToAddSize <= 0) {
22312  return;
22313  }
22314 
22315  response->results = UA_malloc(sizeof(UA_StatusCode) * request->referencesToAddSize);
22316  if(!response->results) {
22318  return;
22319  }
22320  response->resultsSize = request->referencesToAddSize;
22321 
22322  for(size_t i = 0; i < response->resultsSize; ++i)
22323  response->results[i] =
22324  addReference(server, session, &request->referencesToAdd[i]);
22325 }
22326 
22328 UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId,
22329  const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId,
22330  UA_Boolean isForward) {
22331  UA_AddReferencesItem item;
22332  UA_AddReferencesItem_init(&item);
22333  item.sourceNodeId = sourceId;
22334  item.referenceTypeId = refTypeId;
22335  item.isForward = isForward;
22336  item.targetNodeId = targetId;
22337  UA_RCU_LOCK();
22338  UA_StatusCode retval = addReference(server, &adminSession, &item);
22339  UA_RCU_UNLOCK();
22340  return retval;
22341 }
22342 
22343 /****************/
22344 /* Delete Nodes */
22345 /****************/
22346 
22347 static void
22348 removeReferences(UA_Server *server, UA_Session *session, const UA_Node *node) {
22350  UA_DeleteReferencesItem_init(&item);
22351  item.targetNodeId.nodeId = node->nodeId;
22352  for(size_t i = 0; i < node->referencesSize; ++i) {
22353  item.isForward = node->references[i].isInverse;
22354  item.sourceNodeId = node->references[i].targetId.nodeId;
22355  item.referenceTypeId = node->references[i].referenceTypeId;
22356  deleteReference(server, session, &item);
22357  }
22358 }
22359 
22360 static UA_StatusCode
22361 deleteNode(UA_Server *server, UA_Session *session,
22362  const UA_NodeId *nodeId, UA_Boolean deleteReferences) {
22363  const UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
22364  if(!node)
22366 
22367  /* TODO: check if the information model consistency is violated */
22368  /* TODO: Check if the node is a mandatory child of an object */
22369 
22370  /* Destroy an object before removing it */
22371  if(node->nodeClass == UA_NODECLASS_OBJECT) {
22372  /* Call the destructor from the object type */
22373  const UA_ObjectTypeNode *typenode = getObjectNodeType(server, (const UA_ObjectNode*)node);
22374  if(typenode && typenode->lifecycleManagement.destructor)
22375  typenode->lifecycleManagement.destructor(*nodeId, ((const UA_ObjectNode*)node)->instanceHandle);
22376  }
22377 
22378  /* Remove references to the node (not the references in the node that will
22379  * be deleted anyway) */
22380  if(deleteReferences)
22381  removeReferences(server, session, node);
22382 
22383  return UA_NodeStore_remove(server->nodestore, nodeId);
22384 }
22385 
22386 void Service_DeleteNodes(UA_Server *server, UA_Session *session,
22387  const UA_DeleteNodesRequest *request,
22388  UA_DeleteNodesResponse *response) {
22389  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22390  "Processing DeleteNodesRequest");
22391  if(request->nodesToDeleteSize == 0) {
22393  return;
22394  }
22395 
22396  response->results = UA_malloc(sizeof(UA_StatusCode) * request->nodesToDeleteSize);
22397  if(!response->results) {
22399  return;
22400  }
22401  response->resultsSize = request->nodesToDeleteSize;
22402 
22403  for(size_t i = 0; i < request->nodesToDeleteSize; ++i) {
22404  UA_DeleteNodesItem *item = &request->nodesToDelete[i];
22405  response->results[i] = deleteNode(server, session, &item->nodeId,
22406  item->deleteTargetReferences);
22407  }
22408 }
22409 
22411 UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
22412  UA_Boolean deleteReferences) {
22413  UA_RCU_LOCK();
22414  UA_StatusCode retval = deleteNode(server, &adminSession,
22415  &nodeId, deleteReferences);
22416  UA_RCU_UNLOCK();
22417  return retval;
22418 }
22419 
22420 /*********************/
22421 /* Delete References */
22422 /*********************/
22423 
22424 // TODO: Check consistency constraints, remove the references.
22425 static UA_StatusCode
22426 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
22427  const UA_DeleteReferencesItem *item) {
22428  UA_Boolean edited = false;
22429  for(size_t i = node->referencesSize; i > 0; --i) {
22430  UA_ReferenceNode *ref = &node->references[i-1];
22431  if(!UA_NodeId_equal(&item->targetNodeId.nodeId, &ref->targetId.nodeId))
22432  continue;
22433  if(!UA_NodeId_equal(&item->referenceTypeId, &ref->referenceTypeId))
22434  continue;
22435  if(item->isForward == ref->isInverse)
22436  continue;
22437  UA_ReferenceNode_deleteMembers(ref);
22438  /* move the last entry to override the current position */
22439  node->references[i-1] = node->references[node->referencesSize-1];
22440  --node->referencesSize;
22441  edited = true;
22442  break;
22443  }
22444  if(!edited)
22446  /* we removed the last reference */
22447  if(node->referencesSize == 0 && node->references) {
22448  UA_free(node->references);
22449  node->references = NULL;
22450  }
22451  return UA_STATUSCODE_GOOD;;
22452 }
22453 
22454 static UA_StatusCode
22455 deleteReference(UA_Server *server, UA_Session *session,
22456  const UA_DeleteReferencesItem *item) {
22457  UA_StatusCode retval = UA_Server_editNode(server, session, &item->sourceNodeId,
22458  (UA_EditNodeCallback)deleteOneWayReference, item);
22459  if(retval != UA_STATUSCODE_GOOD)
22460  return retval;
22461  if(!item->deleteBidirectional || item->targetNodeId.serverIndex != 0)
22462  return retval;
22463  UA_DeleteReferencesItem secondItem;
22464  UA_DeleteReferencesItem_init(&secondItem);
22465  secondItem.isForward = !item->isForward;
22466  secondItem.sourceNodeId = item->targetNodeId.nodeId;
22467  secondItem.targetNodeId.nodeId = item->sourceNodeId;
22468  secondItem.referenceTypeId = item->referenceTypeId;
22469  return UA_Server_editNode(server, session, &secondItem.sourceNodeId,
22470  (UA_EditNodeCallback)deleteOneWayReference, &secondItem);
22471 }
22472 
22473 void
22474 Service_DeleteReferences(UA_Server *server, UA_Session *session,
22475  const UA_DeleteReferencesRequest *request,
22476  UA_DeleteReferencesResponse *response) {
22477  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22478  "Processing DeleteReferencesRequest");
22479  if(request->referencesToDeleteSize <= 0) {
22481  return;
22482  }
22483 
22484  response->results = UA_malloc(sizeof(UA_StatusCode) * request->referencesToDeleteSize);
22485  if(!response->results) {
22487  return;
22488  }
22489  response->resultsSize = request->referencesToDeleteSize;
22490 
22491  for(size_t i = 0; i < request->referencesToDeleteSize; ++i)
22492  response->results[i] =
22493  deleteReference(server, session, &request->referencesToDelete[i]);
22494 }
22495 
22497 UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId,
22498  const UA_NodeId referenceTypeId,
22499  UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId,
22500  UA_Boolean deleteBidirectional) {
22502  item.sourceNodeId = sourceNodeId;
22503  item.referenceTypeId = referenceTypeId;
22504  item.isForward = isForward;
22505  item.targetNodeId = targetNodeId;
22506  item.deleteBidirectional = deleteBidirectional;
22507  UA_RCU_LOCK();
22508  UA_StatusCode retval = deleteReference(server, &adminSession, &item);
22509  UA_RCU_UNLOCK();
22510  return retval;
22511 }
22512 
22513 /**********************/
22514 /* Set Value Callback */
22515 /**********************/
22516 
22517 static UA_StatusCode
22518 setValueCallback(UA_Server *server, UA_Session *session,
22519  UA_VariableNode *node, UA_ValueCallback *callback) {
22520  if(node->nodeClass != UA_NODECLASS_VARIABLE)
22522  node->value.data.callback = *callback;
22523  return UA_STATUSCODE_GOOD;
22524 }
22525 
22527 UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId,
22528  const UA_ValueCallback callback) {
22529  UA_RCU_LOCK();
22530  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22531  (UA_EditNodeCallback)setValueCallback, &callback);
22532  UA_RCU_UNLOCK();
22533  return retval;
22534 }
22535 
22536 /******************/
22537 /* Set DataSource */
22538 /******************/
22539 
22540 static UA_StatusCode
22541 setDataSource(UA_Server *server, UA_Session *session,
22542  UA_VariableNode* node, UA_DataSource *dataSource) {
22543  if(node->nodeClass != UA_NODECLASS_VARIABLE)
22545  if(node->valueSource == UA_VALUESOURCE_DATA)
22546  UA_DataValue_deleteMembers(&node->value.data.value);
22547  node->value.dataSource = *dataSource;
22548  node->valueSource = UA_VALUESOURCE_DATASOURCE;
22549  return UA_STATUSCODE_GOOD;
22550 }
22551 
22553 UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId,
22554  const UA_DataSource dataSource) {
22555  UA_RCU_LOCK();
22556  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22557  (UA_EditNodeCallback)setDataSource, &dataSource);
22558  UA_RCU_UNLOCK();
22559  return retval;
22560 }
22561 
22562 /****************************/
22563 /* Set Lifecycle Management */
22564 /****************************/
22565 
22566 static UA_StatusCode
22567 setOLM(UA_Server *server, UA_Session *session,
22568  UA_ObjectTypeNode* node, UA_ObjectLifecycleManagement *olm) {
22569  if(node->nodeClass != UA_NODECLASS_OBJECTTYPE)
22571  node->lifecycleManagement = *olm;
22572  return UA_STATUSCODE_GOOD;
22573 }
22574 
22577  UA_ObjectLifecycleManagement olm) {
22578  UA_RCU_LOCK();
22579  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22580  (UA_EditNodeCallback)setOLM, &olm);
22581  UA_RCU_UNLOCK();
22582  return retval;
22583 }
22584 
22585 /***********************/
22586 /* Set Method Callback */
22587 /***********************/
22588 
22589 #ifdef UA_ENABLE_METHODCALLS
22590 
22591 struct addMethodCallback {
22592  UA_MethodCallback callback;
22593  void *handle;
22594 };
22595 
22596 static UA_StatusCode
22597 editMethodCallback(UA_Server *server, UA_Session* session,
22598  UA_Node* node, const void* handle) {
22599  if(node->nodeClass != UA_NODECLASS_METHOD)
22601  const struct addMethodCallback *newCallback = handle;
22602  UA_MethodNode *mnode = (UA_MethodNode*) node;
22603  mnode->attachedMethod = newCallback->callback;
22604  mnode->methodHandle = newCallback->handle;
22605  return UA_STATUSCODE_GOOD;
22606 }
22607 
22609 UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId,
22610  UA_MethodCallback method, void *handle) {
22611  struct addMethodCallback cb = { method, handle };
22612  UA_RCU_LOCK();
22613  UA_StatusCode retval = UA_Server_editNode(server, &adminSession,
22614  &methodNodeId, editMethodCallback, &cb);
22615  UA_RCU_UNLOCK();
22616  return retval;
22617 }
22618 
22619 #endif
22620 
22621 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_view.c" ***********************************/
22622 
22623 /* This Source Code Form is subject to the terms of the Mozilla Public
22624 * License, v. 2.0. If a copy of the MPL was not distributed with this
22625 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
22626 
22627 
22628 static UA_StatusCode
22629 fillReferenceDescription(UA_NodeStore *ns, const UA_Node *curr, UA_ReferenceNode *ref,
22630  UA_UInt32 mask, UA_ReferenceDescription *descr) {
22631  UA_ReferenceDescription_init(descr);
22632  UA_StatusCode retval = UA_NodeId_copy(&curr->nodeId, &descr->nodeId.nodeId);
22634  retval |= UA_NodeId_copy(&ref->referenceTypeId, &descr->referenceTypeId);
22636  descr->isForward = !ref->isInverse;
22638  retval |= UA_NodeClass_copy(&curr->nodeClass, &descr->nodeClass);
22640  retval |= UA_QualifiedName_copy(&curr->browseName, &descr->browseName);
22642  retval |= UA_LocalizedText_copy(&curr->displayName, &descr->displayName);
22644  if(curr->nodeClass == UA_NODECLASS_OBJECT || curr->nodeClass == UA_NODECLASS_VARIABLE) {
22645  for(size_t i = 0; i < curr->referencesSize; ++i) {
22646  UA_ReferenceNode *refnode = &curr->references[i];
22648  retval |= UA_ExpandedNodeId_copy(&refnode->targetId, &descr->typeDefinition);
22649  break;
22650  }
22651  }
22652  }
22653  }
22654  return retval;
22655 }
22656 
22657 
22658 /* Tests if the node is relevant to the browse request and shall be returned. If
22659  so, it is retrieved from the Nodestore. If not, null is returned. */
22660 static const UA_Node *
22661 returnRelevantNode(UA_Server *server, const UA_BrowseDescription *descr, UA_Boolean return_all,
22662  const UA_ReferenceNode *reference, const UA_NodeId *relevant, size_t relevant_count,
22663  UA_Boolean *isExternal) {
22664  /* reference in the right direction? */
22665  if(reference->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_FORWARD)
22666  return NULL;
22667  if(!reference->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_INVERSE)
22668  return NULL;
22669 
22670  /* is the reference part of the hierarchy of references we look for? */
22671  if(!return_all) {
22672  UA_Boolean is_relevant = false;
22673  for(size_t i = 0; i < relevant_count; ++i) {
22674  if(UA_NodeId_equal(&reference->referenceTypeId, &relevant[i])) {
22675  is_relevant = true;
22676  break;
22677  }
22678  }
22679  if(!is_relevant)
22680  return NULL;
22681  }
22682 
22683 
22684  /* return from the internal nodestore */
22685  const UA_Node *node = UA_NodeStore_get(server->nodestore, &reference->targetId.nodeId);
22686  if(node && descr->nodeClassMask != 0 && (node->nodeClass & descr->nodeClassMask) == 0)
22687  return NULL;
22688  *isExternal = false;
22689  return node;
22690 }
22691 
22692 static void removeCp(struct ContinuationPointEntry *cp, UA_Session* session) {
22693  LIST_REMOVE(cp, pointers);
22694  UA_ByteString_deleteMembers(&cp->identifier);
22695  UA_BrowseDescription_deleteMembers(&cp->browseDescription);
22696  UA_free(cp);
22697  ++session->availableContinuationPoints;
22698 }
22699 
22700 /* Results for a single browsedescription. This is the inner loop for both
22701  * Browse and BrowseNext
22702  *
22703  * @param session Session to save continuationpoints
22704  * @param ns The nodstore where the to-be-browsed node can be found
22705  * @param cp If cp is not null, we continue from here If cp is null, we can add
22706  * a new continuation point if possible and necessary.
22707  * @param descr If no cp is set, we take the browsedescription from there
22708  * @param maxrefs The maximum number of references the client has requested. If 0,
22709  * all matching references are returned at once.
22710  * @param result The entry in the request */
22711 void
22712 Service_Browse_single(UA_Server *server, UA_Session *session,
22713  struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr,
22714  UA_UInt32 maxrefs, UA_BrowseResult *result) {
22715  size_t referencesCount = 0;
22716  size_t referencesIndex = 0;
22717  /* set the browsedescription if a cp is given */
22718  UA_UInt32 continuationIndex = 0;
22719  struct ContinuationPointEntry *cpLoop = NULL, *cpLast = NULL;
22720  if(cp) {
22721  descr = &cp->browseDescription;
22722  maxrefs = cp->maxReferences;
22723  continuationIndex = cp->continuationIndex;
22724  }
22725 
22726  /* is the browsedirection valid? */
22731  return;
22732  }
22733 
22734  /* get the references that match the browsedescription */
22735  size_t relevant_refs_size = 0;
22736  UA_NodeId *relevant_refs = NULL;
22737  UA_Boolean all_refs = UA_NodeId_isNull(&descr->referenceTypeId);
22738  if(!all_refs) {
22739  const UA_Node *rootRef = UA_NodeStore_get(server->nodestore, &descr->referenceTypeId);
22740  if(!rootRef || rootRef->nodeClass != UA_NODECLASS_REFERENCETYPE) {
22742  return;
22743  }
22744  if(descr->includeSubtypes) {
22745  result->statusCode = getTypeHierarchy(server->nodestore, rootRef, false,
22746  &relevant_refs, &relevant_refs_size);
22747  if(result->statusCode != UA_STATUSCODE_GOOD)
22748  return;
22749  } else {
22750  relevant_refs = (UA_NodeId*)(uintptr_t)&descr->referenceTypeId;
22751  relevant_refs_size = 1;
22752  }
22753  }
22754 
22755  /* get the node */
22756  const UA_Node *node = UA_NodeStore_get(server->nodestore, &descr->nodeId);
22757  if(!node) {
22759  if(!all_refs && descr->includeSubtypes)
22760  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22761  return;
22762  }
22763 
22764  /* if the node has no references, just return */
22765  if(node->referencesSize == 0) {
22766  result->referencesSize = 0;
22767  if(!all_refs && descr->includeSubtypes)
22768  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22769  return;
22770  }
22771 
22772  /* how many references can we return at most? */
22773  size_t real_maxrefs = maxrefs;
22774  if(real_maxrefs == 0)
22775  real_maxrefs = node->referencesSize;
22776  else if(real_maxrefs > node->referencesSize)
22777  real_maxrefs = node->referencesSize;
22779  if(!result->references) {
22781  goto cleanup;
22782  }
22783 
22784  /* loop over the node's references */
22785  size_t skipped = 0;
22786  UA_Boolean isExternal = false;
22788  for(; referencesIndex < node->referencesSize && referencesCount < real_maxrefs; ++referencesIndex) {
22789  isExternal = false;
22790  const UA_Node *current =
22791  returnRelevantNode(server, descr, all_refs, &node->references[referencesIndex],
22792  relevant_refs, relevant_refs_size, &isExternal);
22793  if(!current)
22794  continue;
22795 
22796  if(skipped < continuationIndex) {
22797  ++skipped;
22798  } else {
22799  retval |= fillReferenceDescription(server->nodestore, current,
22800  &node->references[referencesIndex],
22801  descr->resultMask,
22802  &result->references[referencesCount]);
22803  ++referencesCount;
22804  }
22805  }
22806  result->referencesSize = referencesCount;
22807 
22808  if(referencesCount == 0) {
22809  UA_free(result->references);
22810  result->references = NULL;
22811  result->referencesSize = 0;
22812  }
22813 
22814  if(retval != UA_STATUSCODE_GOOD) {
22815  UA_Array_delete(result->references, result->referencesSize,
22816  &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]);
22817  result->references = NULL;
22818  result->referencesSize = 0;
22819  result->statusCode = retval;
22820  }
22821 
22822  cleanup:
22823  if(!all_refs && descr->includeSubtypes)
22824  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22825  if(result->statusCode != UA_STATUSCODE_GOOD)
22826  return;
22827 
22828  /* create, update, delete continuation points */
22829  if(cp) {
22830  if(referencesIndex == node->referencesSize) {
22831  /* all done, remove a finished continuationPoint */
22832  removeCp(cp, session);
22833  } else {
22834  /* update the cp and return the cp identifier */
22835  cp->continuationIndex += (UA_UInt32)referencesCount;
22836  UA_ByteString_copy(&cp->identifier, &result->continuationPoint);
22837  }
22838  } else if(maxrefs != 0 && referencesCount >= maxrefs) {
22839  if (session->availableContinuationPoints <= 0) {
22840  // if no more ContinuationPoints are available,
22841  // we delete the last one
22842  LIST_FOREACH(cpLoop, &session->continuationPoints, pointers) {
22843  cpLast = cpLoop;
22844  }
22845 
22846  if (cpLast) {
22847  removeCp(cpLast, session);
22848  }
22849  }
22850 
22851  /* create a cp */
22852  if (session->availableContinuationPoints <= 0 ||
22853  !(cp = UA_malloc(sizeof(struct ContinuationPointEntry)))) {
22855  return;
22856  }
22857  UA_BrowseDescription_copy(descr, &cp->browseDescription);
22858  cp->maxReferences = maxrefs;
22859  cp->continuationIndex = (UA_UInt32) referencesCount;
22860  UA_Guid *ident = UA_Guid_new();
22861  *ident = UA_Guid_random();
22862  cp->identifier.data = (UA_Byte*) ident;
22863  cp->identifier.length = sizeof(UA_Guid);
22864  UA_ByteString_copy(&cp->identifier, &result->continuationPoint);
22865 
22866  /* store the cp */
22867  LIST_INSERT_HEAD(&session->continuationPoints, cp, pointers);
22868  --session->availableContinuationPoints;
22869  }
22870 }
22871 
22872 void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request,
22873  UA_BrowseResponse *response) {
22874  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseRequest");
22875  if(!UA_NodeId_isNull(&request->view.viewId)) {
22877  return;
22878  }
22879 
22880  if(request->nodesToBrowseSize <= 0) {
22882  return;
22883  }
22884 
22885  size_t size = request->nodesToBrowseSize;
22886  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]);
22887  if(!response->results) {
22889  return;
22890  }
22891  response->resultsSize = size;
22892 
22893 
22894  for(size_t i = 0; i < size; ++i) {
22895  Service_Browse_single(server, session, NULL, &request->nodesToBrowse[i],
22896  request->requestedMaxReferencesPerNode, &response->results[i]);
22897  }
22898 }
22899 
22901 UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr) {
22902  UA_BrowseResult result;
22903  UA_BrowseResult_init(&result);
22904  UA_RCU_LOCK();
22905  Service_Browse_single(server, &adminSession, NULL, descr, maxrefs, &result);
22906  UA_RCU_UNLOCK();
22907  return result;
22908 }
22909 
22910 static void
22911 UA_Server_browseNext_single(UA_Server *server, UA_Session *session, UA_Boolean releaseContinuationPoint,
22912  const UA_ByteString *continuationPoint, UA_BrowseResult *result) {
22914  struct ContinuationPointEntry *cp, *temp;
22915  LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) {
22916  if(UA_ByteString_equal(&cp->identifier, continuationPoint)) {
22917  result->statusCode = UA_STATUSCODE_GOOD;
22918  if(!releaseContinuationPoint)
22919  Service_Browse_single(server, session, cp, NULL, 0, result);
22920  else
22921  removeCp(cp, session);
22922  break;
22923  }
22924  }
22925 }
22926 
22927 void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request,
22928  UA_BrowseNextResponse *response) {
22929  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseNextRequest");
22930  if(request->continuationPointsSize <= 0) {
22932  return;
22933  }
22934  size_t size = request->continuationPointsSize;
22935  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]);
22936  if(!response->results) {
22938  return;
22939  }
22940 
22941  response->resultsSize = size;
22942  for(size_t i = 0; i < size; ++i)
22943  UA_Server_browseNext_single(server, session, request->releaseContinuationPoints,
22944  &request->continuationPoints[i], &response->results[i]);
22945 }
22946 
22948 UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint,
22949  const UA_ByteString *continuationPoint) {
22950  UA_BrowseResult result;
22951  UA_BrowseResult_init(&result);
22952  UA_RCU_LOCK();
22953  UA_Server_browseNext_single(server, &adminSession, releaseContinuationPoint,
22954  continuationPoint, &result);
22955  UA_RCU_UNLOCK();
22956  return result;
22957 }
22958 
22959 /***********************/
22960 /* TranslateBrowsePath */
22961 /***********************/
22962 
22963 static void
22964 walkBrowsePathElementNodeReference(UA_BrowsePathResult *result, size_t *targetsSize,
22965  UA_NodeId **next, size_t *nextSize, size_t *nextCount,
22966  UA_UInt32 elemDepth, UA_Boolean inverse, UA_Boolean all_refs,
22967  const UA_NodeId *reftypes, size_t reftypes_count,
22968  const UA_ReferenceNode *reference) {
22969  /* Does the direction of the reference match? */
22970  if(reference->isInverse != inverse)
22971  return;
22972 
22973  /* Is the node relevant? */
22974  if(!all_refs) {
22975  UA_Boolean match = false;
22976  for(size_t j = 0; j < reftypes_count; ++j) {
22977  if(UA_NodeId_equal(&reference->referenceTypeId, &reftypes[j])) {
22978  match = true;
22979  break;
22980  }
22981  }
22982  if(!match)
22983  return;
22984  }
22985 
22986  /* Does the reference point to an external server? Then add to the
22987  * targets with the right path "depth" */
22988  if(reference->targetId.serverIndex != 0) {
22989  UA_BrowsePathTarget *tempTargets =
22990  UA_realloc(result->targets, sizeof(UA_BrowsePathTarget) * (*targetsSize) * 2);
22991  if(!tempTargets) {
22993  return;
22994  }
22995  result->targets = tempTargets;
22996  (*targetsSize) *= 2;
22997  result->statusCode = UA_ExpandedNodeId_copy(&reference->targetId,
22998  &result->targets[result->targetsSize].targetId);
22999  result->targets[result->targetsSize].remainingPathIndex = elemDepth;
23000  return;
23001  }
23002 
23003  /* Add the node to the next array for the following path element */
23004  if(*nextSize <= *nextCount) {
23005  UA_NodeId *tempNext = UA_realloc(*next, sizeof(UA_NodeId) * (*nextSize) * 2);
23006  if(!tempNext) {
23008  return;
23009  }
23010  *next = tempNext;
23011  (*nextSize) *= 2;
23012  }
23013  result->statusCode = UA_NodeId_copy(&reference->targetId.nodeId,
23014  &(*next)[*nextCount]);
23015  ++(*nextCount);
23016 }
23017 
23018 static void
23019 walkBrowsePathElement(UA_Server *server, UA_Session *session,
23020  UA_BrowsePathResult *result, size_t *targetsSize,
23021  const UA_RelativePathElement *elem, UA_UInt32 elemDepth,
23022  const UA_QualifiedName *targetName,
23023  const UA_NodeId *current, const size_t currentCount,
23024  UA_NodeId **next, size_t *nextSize, size_t *nextCount) {
23025  /* Get the full list of relevant referencetypes for this path element */
23026  UA_NodeId *reftypes = NULL;
23027  size_t reftypes_count = 1; // all_refs or no subtypes => 1
23028  UA_Boolean all_refs = false;
23029  if(UA_NodeId_isNull(&elem->referenceTypeId)) {
23030  all_refs = true;
23031  } else if(!elem->includeSubtypes) {
23032  reftypes = (UA_NodeId*)(uintptr_t)&elem->referenceTypeId; // ptr magic due to const cast
23033  } else {
23034  const UA_Node *rootRef = UA_NodeStore_get(server->nodestore, &elem->referenceTypeId);
23035  if(!rootRef || rootRef->nodeClass != UA_NODECLASS_REFERENCETYPE)
23036  return;
23037  UA_StatusCode retval =
23038  getTypeHierarchy(server->nodestore, rootRef, false, &reftypes, &reftypes_count);
23039  if(retval != UA_STATUSCODE_GOOD)
23040  return;
23041  }
23042 
23043  /* Iterate over all nodes at the current depth-level */
23044  for(size_t i = 0; i < currentCount; ++i) {
23045  /* Get the node */
23046  const UA_Node *node = UA_NodeStore_get(server->nodestore, &current[i]);
23047  if(!node) {
23048  /* If we cannot find the node at depth 0, the starting node does not exist */
23049  if(elemDepth == 0)
23051  continue;
23052  }
23053 
23054  /* Test whether the current node has the target name required in the
23055  * previous path element */
23056  if(targetName && (targetName->namespaceIndex != node->browseName.namespaceIndex ||
23057  !UA_String_equal(&targetName->name, &node->browseName.name)))
23058  continue;
23059 
23060  /* Walk over the references in the node */
23061  /* Loop over the nodes references */
23062  for(size_t r = 0; r < node->referencesSize &&
23063  result->statusCode == UA_STATUSCODE_GOOD; ++r) {
23064  UA_ReferenceNode *reference = &node->references[r];
23065  walkBrowsePathElementNodeReference(result, targetsSize, next, nextSize, nextCount,
23066  elemDepth, elem->isInverse, all_refs,
23067  reftypes, reftypes_count, reference);
23068  }
23069  }
23070 
23071  if(!all_refs && elem->includeSubtypes)
23072  UA_Array_delete(reftypes, reftypes_count, &UA_TYPES[UA_TYPES_NODEID]);
23073 }
23074 
23075 /* This assumes that result->targets has enough room for all currentCount elements */
23076 static void
23077 addBrowsePathTargets(UA_Server *server, UA_Session *session, UA_BrowsePathResult *result,
23078  const UA_QualifiedName *targetName, UA_NodeId *current, size_t currentCount) {
23079  for(size_t i = 0; i < currentCount; i++) {
23080  /* Get the node */
23081  const UA_Node *node = UA_NodeStore_get(server->nodestore, &current[i]);
23082  if(!node) {
23083  UA_NodeId_deleteMembers(&current[i]);
23084  continue;
23085  }
23086 
23087  /* Test whether the current node has the target name required in the
23088  * previous path element */
23089  if(targetName->namespaceIndex != node->browseName.namespaceIndex ||
23090  !UA_String_equal(&targetName->name, &node->browseName.name)) {
23091  UA_NodeId_deleteMembers(&current[i]);
23092  continue;
23093  }
23094 
23095  /* Move the nodeid to the target array */
23096  UA_BrowsePathTarget_init(&result->targets[result->targetsSize]);
23097  result->targets[result->targetsSize].targetId.nodeId = current[i];
23099  ++result->targetsSize;
23100  }
23101 }
23102 
23103 static void
23104 walkBrowsePath(UA_Server *server, UA_Session *session, const UA_BrowsePath *path,
23105  UA_BrowsePathResult *result, size_t targetsSize,
23106  UA_NodeId **current, size_t *currentSize, size_t *currentCount,
23107  UA_NodeId **next, size_t *nextSize, size_t *nextCount) {
23108  UA_assert(*currentCount == 1);
23109  UA_assert(*nextCount == 0);
23110 
23111  /* Points to the targetName of the _previous_ path element */
23112  const UA_QualifiedName *targetName = NULL;
23113 
23114  /* Iterate over path elements */
23115  UA_assert(path->relativePath.elementsSize > 0);
23116  for(UA_UInt32 i = 0; i < path->relativePath.elementsSize; ++i) {
23117  walkBrowsePathElement(server, session, result, &targetsSize,
23118  &path->relativePath.elements[i], i, targetName,
23119  *current, *currentCount, next, nextSize, nextCount);
23120 
23121  /* Clean members of current */
23122  for(size_t j = 0; j < *currentCount; j++)
23123  UA_NodeId_deleteMembers(&(*current)[j]);
23124  *currentCount = 0;
23125 
23126  /* When no targets are left or an error occurred. None of next's
23127  * elements will be copied to result->targets */
23128  if(*nextCount == 0 || result->statusCode != UA_STATUSCODE_GOOD) {
23129  UA_assert(*currentCount == 0);
23130  UA_assert(*nextCount == 0);
23131  return;
23132  }
23133 
23134  /* Exchange current and next for the next depth */
23135  size_t tSize = *currentSize; size_t tCount = *currentCount; UA_NodeId *tT = *current;
23136  *currentSize = *nextSize; *currentCount = *nextCount; *current = *next;
23137  *nextSize = tSize; *nextCount = tCount; *next = tT;
23138 
23139  /* Store the target name of the previous path element */
23140  targetName = &path->relativePath.elements[i].targetName;
23141  }
23142 
23143  UA_assert(targetName != NULL);
23144  UA_assert(*nextCount == 0);
23145 
23146  /* After the last BrowsePathElement, move members from current to the
23147  * result targets */
23148 
23149  /* Realloc if more space is needed */
23150  if(targetsSize < result->targetsSize + (*currentCount)) {
23151  UA_BrowsePathTarget *newTargets =
23153  (result->targetsSize + (*currentCount)));
23154  if(!newTargets) {
23156  for(size_t i = 0; i < *currentCount; ++i)
23157  UA_NodeId_deleteMembers(&(*current)[i]);
23158  *currentCount = 0;
23159  return;
23160  }
23161  result->targets = newTargets;
23162  }
23163 
23164  /* Move the elements of current to the targets */
23165  addBrowsePathTargets(server, session, result, targetName, *current, *currentCount);
23166  *currentCount = 0;
23167 }
23168 
23169 static void
23170 translateBrowsePathToNodeIds(UA_Server *server, UA_Session *session,
23171  const UA_BrowsePath *path, UA_BrowsePathResult *result) {
23172  if(path->relativePath.elementsSize <= 0) {
23174  return;
23175  }
23176 
23177  /* RelativePath elements must not have an empty targetName */
23178  for(size_t i = 0; i < path->relativePath.elementsSize; ++i) {
23179  if(UA_QualifiedName_isNull(&path->relativePath.elements[i].targetName)) {
23181  return;
23182  }
23183  }
23184 
23185  /* Allocate memory for the targets */
23186  size_t targetsSize = 10; /* When to realloc; the member count is stored in
23187  * result->targetsSize */
23188  result->targets = (UA_BrowsePathTarget*)UA_malloc(sizeof(UA_BrowsePathTarget) * targetsSize);
23189  if(!result->targets) {
23191  return;
23192  }
23193 
23194  /* Allocate memory for two temporary arrays. One with the results for the
23195  * previous depth of the path. The other for the new results at the current
23196  * depth. The two arrays alternate as we descend down the tree. */
23197  size_t currentSize = 10; /* When to realloc */
23198  size_t currentCount = 0; /* Current elements */
23199  UA_NodeId *current = (UA_NodeId*)UA_malloc(sizeof(UA_NodeId) * currentSize);
23200  if(!current) {
23202  UA_free(result->targets);
23203  return;
23204  }
23205  size_t nextSize = 10; /* When to realloc */
23206  size_t nextCount = 0; /* Current elements */
23207  UA_NodeId *next = (UA_NodeId*)UA_malloc(sizeof(UA_NodeId) * nextSize);
23208  if(!next) {
23210  UA_free(result->targets);
23211  UA_free(current);
23212  return;
23213  }
23214 
23215  /* Copy the starting node into current */
23216  result->statusCode = UA_NodeId_copy(&path->startingNode, &current[0]);
23217  if(result->statusCode != UA_STATUSCODE_GOOD) {
23218  UA_free(result->targets);
23219  UA_free(current);
23220  UA_free(next);
23221  return;
23222  }
23223  currentCount = 1;
23224 
23225  /* Walk the path elements */
23226  walkBrowsePath(server, session, path, result, targetsSize,
23227  &current, &currentSize, &currentCount,
23228  &next, &nextSize, &nextCount);
23229 
23230  UA_assert(currentCount == 0);
23231  UA_assert(nextCount == 0);
23232 
23233  /* No results => BadNoMatch status code */
23234  if(result->targetsSize == 0 && result->statusCode == UA_STATUSCODE_GOOD)
23236 
23237  /* Clean up the temporary arrays and the targets */
23238  UA_free(current);
23239  UA_free(next);
23240  if(result->statusCode != UA_STATUSCODE_GOOD) {
23241  for(size_t i = 0; i < result->targetsSize; ++i)
23242  UA_BrowsePathTarget_deleteMembers(&result->targets[i]);
23243  UA_free(result->targets);
23244  result->targets = NULL;
23245  result->targetsSize = 0;
23246  }
23247 }
23248 
23251  const UA_BrowsePath *browsePath) {
23252  UA_BrowsePathResult result;
23253  UA_BrowsePathResult_init(&result);
23254  UA_RCU_LOCK();
23255  translateBrowsePathToNodeIds(server, &adminSession, browsePath, &result);
23256  UA_RCU_UNLOCK();
23257  return result;
23258 }
23259 
23260 void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
23263  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing TranslateBrowsePathsToNodeIdsRequest");
23264  if(request->browsePathsSize <= 0) {
23266  return;
23267  }
23268 
23269  size_t size = request->browsePathsSize;
23271  if(!response->results) {
23273  return;
23274  }
23275 
23276  response->resultsSize = size;
23277  for(size_t i = 0; i < size; ++i)
23278  translateBrowsePathToNodeIds(server, session, &request->browsePaths[i],
23279  &response->results[i]);
23280 
23281 }
23282 
23283 void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request,
23284  UA_RegisterNodesResponse *response) {
23285  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterNodesRequest");
23286  //TODO: hang the nodeids to the session if really needed
23288  if(request->nodesToRegisterSize <= 0)
23290  else {
23291  response->responseHeader.serviceResult =
23293  (void**)&response->registeredNodeIds, &UA_TYPES[UA_TYPES_NODEID]);
23295  response->registeredNodeIdsSize = request->nodesToRegisterSize;
23296  }
23297 }
23298 
23299 void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request,
23300  UA_UnregisterNodesResponse *response) {
23301  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing UnRegisterNodesRequest");
23302  //TODO: remove the nodeids from the session if really needed
23304  if(request->nodesToUnregisterSize==0)
23306 }
23307 
23308 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_call.c" ***********************************/
23309 
23310 /* This Source Code Form is subject to the terms of the Mozilla Public
23311 * License, v. 2.0. If a copy of the MPL was not distributed with this
23312 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
23313 
23314 
23315 #ifdef UA_ENABLE_METHODCALLS /* conditional compilation */
23316 
23317 static const UA_VariableNode *
23318 getArgumentsVariableNode(UA_Server *server, const UA_MethodNode *ofMethod,
23319  UA_String withBrowseName) {
23320  UA_NodeId hasProperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
23321  for(size_t i = 0; i < ofMethod->referencesSize; ++i) {
23322  if(ofMethod->references[i].isInverse == false &&
23323  UA_NodeId_equal(&hasProperty, &ofMethod->references[i].referenceTypeId)) {
23324  const UA_Node *refTarget =
23325  UA_NodeStore_get(server->nodestore, &ofMethod->references[i].targetId.nodeId);
23326  if(!refTarget)
23327  continue;
23328  if(refTarget->nodeClass == UA_NODECLASS_VARIABLE &&
23329  refTarget->browseName.namespaceIndex == 0 &&
23330  UA_String_equal(&withBrowseName, &refTarget->browseName.name)) {
23331  return (const UA_VariableNode*) refTarget;
23332  }
23333  }
23334  }
23335  return NULL;
23336 }
23337 
23338 static UA_StatusCode
23339 argumentsConformsToDefinition(UA_Server *server, const UA_VariableNode *argRequirements,
23340  size_t argsSize, UA_Variant *args) {
23341  if(argRequirements->value.data.value.value.type != &UA_TYPES[UA_TYPES_ARGUMENT])
23343  UA_Argument *argReqs = (UA_Argument*)argRequirements->value.data.value.value.data;
23344  size_t argReqsSize = argRequirements->value.data.value.value.arrayLength;
23345  if(argRequirements->valueSource != UA_VALUESOURCE_DATA)
23347  if(UA_Variant_isScalar(&argRequirements->value.data.value.value))
23348  argReqsSize = 1;
23349  if(argReqsSize > argsSize)
23351  if(argReqsSize != argsSize)
23353 
23355  for(size_t i = 0; i < argReqsSize; ++i)
23356  retval |= typeCheckValue(server, &argReqs[i].dataType, argReqs[i].valueRank,
23357  argReqs[i].arrayDimensionsSize, argReqs[i].arrayDimensions,
23358  &args[i], NULL, &args[i]);
23359  return retval;
23360 }
23361 
23362 void
23363 Service_Call_single(UA_Server *server, UA_Session *session,
23364  const UA_CallMethodRequest *request,
23365  UA_CallMethodResult *result) {
23366  /* Get/verify the method node */
23367  const UA_MethodNode *methodCalled =
23368  (const UA_MethodNode*)UA_NodeStore_get(server->nodestore, &request->methodId);
23369  if(!methodCalled) {
23371  return;
23372  }
23373  if(methodCalled->nodeClass != UA_NODECLASS_METHOD) {
23375  return;
23376  }
23377  if(!methodCalled->executable || !methodCalled->userExecutable || !methodCalled->attachedMethod) {
23378  result->statusCode = UA_STATUSCODE_BADNOTWRITABLE; // There is no NOTEXECUTABLE?
23379  return;
23380  }
23381 
23382  /* Get/verify the object node */
23383  const UA_ObjectNode *withObject =
23384  (const UA_ObjectNode*)UA_NodeStore_get(server->nodestore, &request->objectId);
23385  if(!withObject) {
23387  return;
23388  }
23389  if(withObject->nodeClass != UA_NODECLASS_OBJECT && withObject->nodeClass != UA_NODECLASS_OBJECTTYPE) {
23391  return;
23392  }
23393 
23394  /* Verify method/object relations. Object must have a hasComponent or a
23395  * subtype of hasComponent reference to the method node. Therefore, check
23396  * every reference between the parent object and the method node if there is
23397  * a hasComponent (or subtype) reference */
23398  UA_Boolean found = false;
23399  UA_NodeId hasComponentNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASCOMPONENT);
23400  UA_NodeId hasSubTypeNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASSUBTYPE);
23401  for(size_t i = 0; i < methodCalled->referencesSize; ++i) {
23402  if(methodCalled->references[i].isInverse &&
23403  UA_NodeId_equal(&methodCalled->references[i].targetId.nodeId, &withObject->nodeId)) {
23404  found = isNodeInTree(server->nodestore, &methodCalled->references[i].referenceTypeId,
23405  &hasComponentNodeId, &hasSubTypeNodeId, 1);
23406  if(found)
23407  break;
23408  }
23409  }
23410  if(!found) {
23412  return;
23413  }
23414 
23415  /* Verify Input Argument count, types and sizes */
23416  const UA_VariableNode *inputArguments =
23417  getArgumentsVariableNode(server, methodCalled, UA_STRING("InputArguments"));
23418 
23419  if(!inputArguments) {
23420  if(request->inputArgumentsSize > 0) {
23422  return;
23423  }
23424  } else {
23425  result->statusCode = argumentsConformsToDefinition(server, inputArguments,
23426  request->inputArgumentsSize,
23427  request->inputArguments);
23428  if(result->statusCode != UA_STATUSCODE_GOOD)
23429  return;
23430  }
23431 
23432  /* Allocate the output arguments */
23433  result->outputArgumentsSize = 0; /* the default */
23434  const UA_VariableNode *outputArguments =
23435  getArgumentsVariableNode(server, methodCalled, UA_STRING("OutputArguments"));
23436  if(outputArguments) {
23437  result->outputArguments = UA_Array_new(outputArguments->value.data.value.value.arrayLength,
23439  if(!result->outputArguments) {
23441  return;
23442  }
23443  result->outputArgumentsSize = outputArguments->value.data.value.value.arrayLength;
23444  }
23445 
23446  /* Call the method */
23447 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
23448  methodCallSession = session;
23449 #endif
23450  result->statusCode = methodCalled->attachedMethod(methodCalled->methodHandle, withObject->nodeId,
23451  request->inputArgumentsSize, request->inputArguments,
23452  result->outputArgumentsSize, result->outputArguments);
23453 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
23454  methodCallSession = NULL;
23455 #endif
23456 
23457  /* TODO: Verify Output matches the argument definition */
23458 }
23459 
23460 void Service_Call(UA_Server *server, UA_Session *session,
23461  const UA_CallRequest *request,
23462  UA_CallResponse *response) {
23463  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing CallRequest");
23464  if(request->methodsToCallSize <= 0) {
23466  return;
23467  }
23468 
23470  if(!response->results) {
23472  return;
23473  }
23474  response->resultsSize = request->methodsToCallSize;
23475 
23476 
23477  for(size_t i = 0; i < request->methodsToCallSize;++i){
23478  Service_Call_single(server, session, &request->methodsToCall[i], &response->results[i]);
23479  }
23480 }
23481 
23483 UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request) {
23484  UA_CallMethodResult result;
23485  UA_CallMethodResult_init(&result);
23486  Service_Call_single(server, &adminSession,
23487  request, &result);
23488  return result;
23489 }
23490 
23491 #endif /* UA_ENABLE_METHODCALLS */
23492 
23493 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_subscription.c" ***********************************/
23494 
23495 /* This Source Code Form is subject to the terms of the Mozilla Public
23496 * License, v. 2.0. If a copy of the MPL was not distributed with this
23497 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
23498 
23499 
23500 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
23501 
23502 #define UA_VALUENCODING_MAXSTACK 512
23503 
23504 /*****************/
23505 /* MonitoredItem */
23506 /*****************/
23507 
23510  if(!new)
23511  return NULL;
23512  new->subscription = NULL;
23513  new->currentQueueSize = 0;
23514  new->maxQueueSize = 0;
23515  new->monitoredItemType = UA_MONITOREDITEMTYPE_CHANGENOTIFY; /* currently hardcoded */
23516  new->timestampsToReturn = UA_TIMESTAMPSTORETURN_SOURCE;
23517  UA_String_init(&new->indexRange);
23518  TAILQ_INIT(&new->queue);
23519  UA_NodeId_init(&new->monitoredNodeId);
23520  new->lastSampledValue = UA_BYTESTRING_NULL;
23521  memset(&new->sampleJobGuid, 0, sizeof(UA_Guid));
23522  new->sampleJobIsRegistered = false;
23523  new->itemId = 0;
23524  return new;
23525 }
23526 
23527 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem) {
23528  MonitoredItem_unregisterSampleJob(server, monitoredItem);
23529  /* clear the queued samples */
23530  MonitoredItem_queuedValue *val, *val_tmp;
23531  TAILQ_FOREACH_SAFE(val, &monitoredItem->queue, listEntry, val_tmp) {
23532  TAILQ_REMOVE(&monitoredItem->queue, val, listEntry);
23533  UA_DataValue_deleteMembers(&val->value);
23534  UA_free(val);
23535  }
23536  monitoredItem->currentQueueSize = 0;
23537  LIST_REMOVE(monitoredItem, listEntry);
23538  UA_String_deleteMembers(&monitoredItem->indexRange);
23539  UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
23540  UA_NodeId_deleteMembers(&monitoredItem->monitoredNodeId);
23541  UA_free(monitoredItem);
23542 }
23543 
23544 static void
23545 ensureSpaceInMonitoredItemQueue(UA_MonitoredItem *mon) {
23546  if(mon->currentQueueSize < mon->maxQueueSize)
23547  return;
23548  MonitoredItem_queuedValue *queueItem;
23549  if(mon->discardOldest)
23550  queueItem = TAILQ_FIRST(&mon->queue);
23551  else
23552  queueItem = TAILQ_LAST(&mon->queue, QueueOfQueueDataValues);
23553  UA_assert(queueItem); /* When the currentQueueSize > 0, then there is an item */
23554  TAILQ_REMOVE(&mon->queue, queueItem, listEntry);
23555  UA_DataValue_deleteMembers(&queueItem->value);
23556  UA_free(queueItem);
23557  --mon->currentQueueSize;
23558 }
23559 
23560 /* Has this sample changed from the last one? The method may allocate additional
23561  * space for the encoding buffer. Detect the change in encoding->data. */
23562 static UA_StatusCode
23563 detectValueChange(UA_MonitoredItem *mon, UA_DataValue *value,
23564  UA_ByteString *encoding, UA_Boolean *changed) {
23565  /* Apply Filter */
23566  UA_Boolean hasValue = value->hasValue;
23567  if(mon->trigger == UA_DATACHANGETRIGGER_STATUS)
23568  value->hasValue = false;
23569 
23570  UA_Boolean hasServerTimestamp = value->hasServerTimestamp;
23571  UA_Boolean hasServerPicoseconds = value->hasServerPicoseconds;
23572  value->hasServerTimestamp = false;
23573  value->hasServerPicoseconds = false;
23574 
23575  UA_Boolean hasSourceTimestamp = value->hasSourceTimestamp;
23576  UA_Boolean hasSourcePicoseconds = value->hasSourcePicoseconds;
23577  if(mon->trigger < UA_DATACHANGETRIGGER_STATUSVALUETIMESTAMP) {
23578  value->hasSourceTimestamp = false;
23579  value->hasSourcePicoseconds = false;
23580  }
23581 
23582  /* Encode the data for comparison */
23584  size_t binsize = UA_calcSizeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE]);
23585  if(binsize == 0) {
23587  goto cleanup;
23588  }
23589 
23590  /* Allocate buffer on the heap if necessary */
23591  if(binsize > UA_VALUENCODING_MAXSTACK &&
23592  UA_ByteString_allocBuffer(encoding, binsize) != UA_STATUSCODE_GOOD) {
23594  goto cleanup;
23595  }
23596 
23597  /* Encode the value */
23598  size_t encodingOffset = 0;
23599  retval = UA_encodeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE],
23600  NULL, NULL, encoding, &encodingOffset);
23601  if(retval != UA_STATUSCODE_GOOD)
23602  goto cleanup;
23603 
23604  /* The value has changed */
23605  encoding->length = encodingOffset;
23606  if(!mon->lastSampledValue.data || !UA_String_equal(encoding, &mon->lastSampledValue))
23607  *changed = true;
23608 
23609  cleanup:
23610  /* Reset the filter */
23611  value->hasValue = hasValue;
23612  value->hasServerTimestamp = hasServerTimestamp;
23613  value->hasServerPicoseconds = hasServerPicoseconds;
23614  value->hasSourceTimestamp = hasSourceTimestamp;
23615  value->hasSourcePicoseconds = hasSourcePicoseconds;
23616  return retval;
23617 }
23618 
23619 void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem) {
23620  UA_Subscription *sub = monitoredItem->subscription;
23621  if(monitoredItem->monitoredItemType != UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
23622  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23623  "Subscription %u | MonitoredItem %i | "
23624  "Not a data change notification",
23625  sub->subscriptionID, monitoredItem->itemId);
23626  return;
23627  }
23628 
23629  /* Read the value */
23630  UA_ReadValueId rvid;
23631  UA_ReadValueId_init(&rvid);
23632  rvid.nodeId = monitoredItem->monitoredNodeId;
23633  rvid.attributeId = monitoredItem->attributeID;
23634  rvid.indexRange = monitoredItem->indexRange;
23635  UA_DataValue value;
23636  UA_DataValue_init(&value);
23637  Service_Read_single(server, sub->session, monitoredItem->timestampsToReturn,
23638  &rvid, &value);
23639 
23640  /* Stack-allocate some memory for the value encoding */
23641  UA_Byte *stackValueEncoding = UA_alloca(UA_VALUENCODING_MAXSTACK);
23642  UA_ByteString valueEncoding;
23643  valueEncoding.data = stackValueEncoding;
23644  valueEncoding.length = UA_VALUENCODING_MAXSTACK;
23645 
23646  /* Has the value changed? */
23647  UA_Boolean changed = false;
23648  UA_StatusCode retval = detectValueChange(monitoredItem, &value,
23649  &valueEncoding, &changed);
23650  if(!changed || retval != UA_STATUSCODE_GOOD)
23651  goto cleanup;
23652 
23653  /* Allocate the entry for the publish queue */
23655  if(!newQueueItem) {
23656  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23657  "Subscription %u | MonitoredItem %i | "
23658  "Item for the publishing queue could not be allocated",
23659  sub->subscriptionID, monitoredItem->itemId);
23660  goto cleanup;
23661  }
23662 
23663  /* Copy valueEncoding on the heap for the next comparison (if not already done) */
23664  if(valueEncoding.data == stackValueEncoding) {
23665  UA_ByteString cbs;
23666  if(UA_ByteString_copy(&valueEncoding, &cbs) != UA_STATUSCODE_GOOD) {
23667  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23668  "Subscription %u | MonitoredItem %i | "
23669  "ByteString to compare values could not be created",
23670  sub->subscriptionID, monitoredItem->itemId);
23671  UA_free(newQueueItem);
23672  goto cleanup;
23673  }
23674  valueEncoding = cbs;
23675  }
23676 
23677  /* Prepare the newQueueItem */
23678  if(value.hasValue && value.value.storageType == UA_VARIANT_DATA_NODELETE) {
23679  if(UA_DataValue_copy(&value, &newQueueItem->value) != UA_STATUSCODE_GOOD) {
23680  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23681  "Subscription %u | MonitoredItem %i | "
23682  "Item for the publishing queue could not be prepared",
23683  sub->subscriptionID, monitoredItem->itemId);
23684  UA_free(newQueueItem);
23685  goto cleanup;
23686  }
23687  } else {
23688  newQueueItem->value = value;
23689  }
23690  newQueueItem->clientHandle = monitoredItem->clientHandle;
23691 
23692  /* <-- Point of no return --> */
23693 
23694  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23695  "Subscription %u | MonitoredItem %u | Sampled a new value",
23696  sub->subscriptionID, monitoredItem->itemId);
23697 
23698  /* Replace the encoding for comparison */
23699  UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
23700  monitoredItem->lastSampledValue = valueEncoding;
23701 
23702  /* Add the sample to the queue for publication */
23703  ensureSpaceInMonitoredItemQueue(monitoredItem);
23704  TAILQ_INSERT_TAIL(&monitoredItem->queue, newQueueItem, listEntry);
23705  ++monitoredItem->currentQueueSize;
23706  return;
23707 
23708  cleanup:
23709  if(valueEncoding.data != stackValueEncoding)
23710  UA_ByteString_deleteMembers(&valueEncoding);
23711  UA_DataValue_deleteMembers(&value);
23712 }
23713 
23715 MonitoredItem_registerSampleJob(UA_Server *server, UA_MonitoredItem *mon) {
23716  UA_Job job;
23717  job.type = UA_JOBTYPE_METHODCALL;
23718  job.job.methodCall.method = (UA_ServerCallback)UA_MoniteredItem_SampleCallback;
23719  job.job.methodCall.data = mon;
23720  UA_StatusCode retval = UA_Server_addRepeatedJob(server, job,
23721  (UA_UInt32)mon->samplingInterval,
23722  &mon->sampleJobGuid);
23723  if(retval == UA_STATUSCODE_GOOD)
23724  mon->sampleJobIsRegistered = true;
23725  return retval;
23726 }
23727 
23729  if(!mon->sampleJobIsRegistered)
23730  return UA_STATUSCODE_GOOD;
23731  mon->sampleJobIsRegistered = false;
23732  return UA_Server_removeRepeatedJob(server, mon->sampleJobGuid);
23733 }
23734 
23735 /****************/
23736 /* Subscription */
23737 /****************/
23738 
23739 UA_Subscription * UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID) {
23740  UA_Subscription *new = UA_malloc(sizeof(UA_Subscription));
23741  if(!new)
23742  return NULL;
23743  new->session = session;
23744  new->subscriptionID = subscriptionID;
23745  new->sequenceNumber = 0;
23746  new->maxKeepAliveCount = 0;
23747  new->publishingEnabled = false;
23748  memset(&new->publishJobGuid, 0, sizeof(UA_Guid));
23749  new->publishJobIsRegistered = false;
23750  new->currentKeepAliveCount = 0;
23751  new->currentLifetimeCount = 0;
23752  new->lastMonitoredItemId = 0;
23753  new->state = UA_SUBSCRIPTIONSTATE_NORMAL; /* The first publish response is sent immediately */
23754  LIST_INIT(&new->monitoredItems);
23755  TAILQ_INIT(&new->retransmissionQueue);
23756  new->retransmissionQueueSize = 0;
23757  return new;
23758 }
23759 
23760 void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server) {
23761  Subscription_unregisterPublishJob(server, subscription);
23762 
23763  /* Delete monitored Items */
23764  UA_MonitoredItem *mon, *tmp_mon;
23765  LIST_FOREACH_SAFE(mon, &subscription->monitoredItems, listEntry, tmp_mon) {
23766  LIST_REMOVE(mon, listEntry);
23767  MonitoredItem_delete(server, mon);
23768  }
23769 
23770  /* Delete Retransmission Queue */
23771  UA_NotificationMessageEntry *nme, *nme_tmp;
23772  TAILQ_FOREACH_SAFE(nme, &subscription->retransmissionQueue, listEntry, nme_tmp) {
23773  TAILQ_REMOVE(&subscription->retransmissionQueue, nme, listEntry);
23774  UA_NotificationMessage_deleteMembers(&nme->message);
23775  UA_free(nme);
23776  }
23777  subscription->retransmissionQueueSize = 0;
23778 }
23779 
23782  UA_MonitoredItem *mon;
23783  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23784  if(mon->itemId == monitoredItemID)
23785  break;
23786  }
23787  return mon;
23788 }
23789 
23792  UA_UInt32 monitoredItemID) {
23793  UA_MonitoredItem *mon;
23794  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23795  if(mon->itemId == monitoredItemID) {
23796  LIST_REMOVE(mon, listEntry);
23797  MonitoredItem_delete(server, mon);
23798  return UA_STATUSCODE_GOOD;
23799  }
23800  }
23802 }
23803 
23804 static size_t
23805 countQueuedNotifications(UA_Subscription *sub, UA_Boolean *moreNotifications) {
23806  size_t notifications = 0;
23807  if(sub->publishingEnabled) {
23808  UA_MonitoredItem *mon;
23809  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23811  TAILQ_FOREACH(qv, &mon->queue, listEntry) {
23812  if(notifications >= sub->notificationsPerPublish) {
23813  *moreNotifications = true;
23814  break;
23815  }
23816  ++notifications;
23817  }
23818  }
23819  }
23820  return notifications;
23821 }
23822 
23823 static void
23824 UA_Subscription_addRetransmissionMessage(UA_Server *server, UA_Subscription *sub,
23825  UA_NotificationMessageEntry *entry) {
23826  /* Release the oldest entry if there is not enough space */
23827  if(server->config.maxRetransmissionQueueSize > 0 &&
23828  sub->retransmissionQueueSize >= server->config.maxRetransmissionQueueSize) {
23829  UA_NotificationMessageEntry *lastentry =
23830  TAILQ_LAST(&sub->retransmissionQueue, UA_ListOfNotificationMessages);
23831  TAILQ_REMOVE(&sub->retransmissionQueue, lastentry, listEntry);
23832  --sub->retransmissionQueueSize;
23833  UA_NotificationMessage_deleteMembers(&lastentry->message);
23834  UA_free(lastentry);
23835  }
23836 
23837  /* Add entry */
23838  TAILQ_INSERT_HEAD(&sub->retransmissionQueue, entry, listEntry);
23839  ++sub->retransmissionQueueSize;
23840 }
23841 
23844  UA_NotificationMessageEntry *entry, *entry_tmp;
23845  TAILQ_FOREACH_SAFE(entry, &sub->retransmissionQueue, listEntry, entry_tmp) {
23846  if(entry->message.sequenceNumber != sequenceNumber)
23847  continue;
23848  TAILQ_REMOVE(&sub->retransmissionQueue, entry, listEntry);
23849  --sub->retransmissionQueueSize;
23850  UA_NotificationMessage_deleteMembers(&entry->message);
23851  UA_free(entry);
23852  return UA_STATUSCODE_GOOD;
23853  }
23855 }
23856 
23857 static UA_StatusCode
23858 prepareNotificationMessage(UA_Subscription *sub, UA_NotificationMessage *message,
23859  size_t notifications) {
23860  /* Array of ExtensionObject to hold different kinds of notifications
23861  (currently only DataChangeNotifications) */
23863  if(!message->notificationData)
23865  message->notificationDataSize = 1;
23866 
23867  /* Allocate Notification */
23868  UA_DataChangeNotification *dcn = UA_DataChangeNotification_new();
23869  if(!dcn)
23870  goto cleanup;
23871  UA_ExtensionObject *data = message->notificationData;
23873  data->content.decoded.data = dcn;
23875 
23876  /* Allocate array of notifications */
23877  dcn->monitoredItems =
23879  if(!dcn->monitoredItems)
23880  goto cleanup;
23881  dcn->monitoredItemsSize = notifications;
23882 
23883  /* Move notifications into the response .. the point of no return */
23884  size_t l = 0;
23885  UA_MonitoredItem *mon;
23886  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23887  MonitoredItem_queuedValue *qv, *qv_tmp;
23888  TAILQ_FOREACH_SAFE(qv, &mon->queue, listEntry, qv_tmp) {
23889  if(l >= notifications)
23890  return UA_STATUSCODE_GOOD;
23892  min->clientHandle = qv->clientHandle;
23893  min->value = qv->value;
23894  TAILQ_REMOVE(&mon->queue, qv, listEntry);
23895  UA_free(qv);
23896  --mon->currentQueueSize;
23897  ++l;
23898  }
23899  }
23900  return UA_STATUSCODE_GOOD;
23901 
23902  cleanup:
23903  UA_NotificationMessage_deleteMembers(message);
23905 }
23906 
23907 void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) {
23908  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
23909  "Publish Callback", sub->subscriptionID);
23910 
23911  /* Count the available notifications */
23912  UA_Boolean moreNotifications = false;
23913  size_t notifications = countQueuedNotifications(sub, &moreNotifications);
23914 
23915  /* Return if nothing to do */
23916  if(notifications == 0) {
23917  ++sub->currentKeepAliveCount;
23918  if(sub->currentKeepAliveCount < sub->maxKeepAliveCount)
23919  return;
23920  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23921  "Subscription %u | Sending a KeepAlive",
23922  sub->subscriptionID)
23923  }
23924 
23925  /* Check if the securechannel is valid */
23926  UA_SecureChannel *channel = sub->session->channel;
23927  if(!channel)
23928  return;
23929 
23930  /* Dequeue a response */
23931  UA_PublishResponseEntry *pre = SIMPLEQ_FIRST(&sub->session->responseQueue);
23932 
23933  /* Cannot publish without a response */
23934  if(!pre) {
23935  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23936  "Subscription %u | Cannot send a publish response "
23937  "since the publish queue is empty", sub->subscriptionID)
23938  if(sub->state != UA_SUBSCRIPTIONSTATE_LATE) {
23939  sub->state = UA_SUBSCRIPTIONSTATE_LATE;
23940  } else {
23941  ++sub->currentLifetimeCount;
23942  if(sub->currentLifetimeCount > sub->lifeTimeCount) {
23943  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
23944  "End of lifetime for subscription", sub->subscriptionID);
23945  UA_Session_deleteSubscription(server, sub->session, sub->subscriptionID);
23946  }
23947  }
23948  return;
23949  }
23950 
23951  UA_PublishResponse *response = &pre->response;
23952  UA_NotificationMessage *message = &response->notificationMessage;
23953  UA_NotificationMessageEntry *retransmission = NULL;
23954  if(notifications > 0) {
23955  /* Allocate the retransmission entry */
23956  retransmission = UA_malloc(sizeof(UA_NotificationMessageEntry));
23957  if(!retransmission) {
23958  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23959  "Subscription %u | Could not allocate memory "
23960  "for retransmission", sub->subscriptionID);
23961  return;
23962  }
23963  /* Prepare the response */
23964  UA_StatusCode retval =
23965  prepareNotificationMessage(sub, message, notifications);
23966  if(retval != UA_STATUSCODE_GOOD) {
23967  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23968  "Subscription %u | Could not prepare the "
23969  "notification message", sub->subscriptionID);
23970  UA_free(retransmission);
23971  return;
23972  }
23973  }
23974 
23975  /* <-- The point of no return --> */
23976 
23977  /* Remove the response from the response queue */
23978  SIMPLEQ_REMOVE_HEAD(&sub->session->responseQueue, listEntry);
23979 
23980  /* Set up the response */
23982  response->subscriptionId = sub->subscriptionID;
23983  response->moreNotifications = moreNotifications;
23984  message->publishTime = response->responseHeader.timestamp;
23985  if(notifications == 0) {
23986  /* Send sequence number for the next notification */
23987  message->sequenceNumber = sub->sequenceNumber + 1;
23988  } else {
23989  /* Increase the sequence number */
23990  message->sequenceNumber = ++sub->sequenceNumber;
23991 
23992  /* Put the notification message into the retransmission queue. This needs to
23993  * be done here, so that the message itself is included in the available
23994  * sequence numbers for acknowledgement. */
23995  retransmission->message = response->notificationMessage;
23996  UA_Subscription_addRetransmissionMessage(server, sub, retransmission);
23997  }
23998 
23999  /* Get the available sequence numbers from the retransmission queue */
24000  size_t available = sub->retransmissionQueueSize;
24001  if(available > 0) {
24002  response->availableSequenceNumbers = UA_alloca(available * sizeof(UA_UInt32));
24003  response->availableSequenceNumbersSize = available;
24004  size_t i = 0;
24006  TAILQ_FOREACH(nme, &sub->retransmissionQueue, listEntry) {
24007  response->availableSequenceNumbers[i] = nme->message.sequenceNumber;
24008  ++i;
24009  }
24010  }
24011 
24012  /* Send the response */
24013  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24014  "Subscription %u | Sending out a publish response with %u "
24015  "notifications", sub->subscriptionID, (UA_UInt32)notifications);
24016  UA_SecureChannel_sendBinaryMessage(sub->session->channel, pre->requestId, response,
24018 
24019  /* Reset subscription state to normal. */
24020  sub->state = UA_SUBSCRIPTIONSTATE_NORMAL;
24021  sub->currentKeepAliveCount = 0;
24022  sub->currentLifetimeCount = 0;
24023 
24024  /* Free the response */
24025  UA_Array_delete(response->results, response->resultsSize,
24027  UA_free(pre); /* no need for UA_PublishResponse_deleteMembers */
24028 
24029  /* Repeat if there are more notifications to send */
24030  if(moreNotifications)
24031  UA_Subscription_publishCallback(server, sub);
24032 }
24033 
24035 Subscription_registerPublishJob(UA_Server *server, UA_Subscription *sub) {
24036  if(sub->publishJobIsRegistered)
24037  return UA_STATUSCODE_GOOD;
24038 
24039  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24040  "Subscription %u | Register subscription publishing callback",
24041  sub->subscriptionID);
24042  UA_Job job;
24043  job.type = UA_JOBTYPE_METHODCALL;
24044  job.job.methodCall.method = (UA_ServerCallback)UA_Subscription_publishCallback;
24045  job.job.methodCall.data = sub;
24046  UA_StatusCode retval =
24047  UA_Server_addRepeatedJob(server, job, (UA_UInt32)sub->publishingInterval,
24048  &sub->publishJobGuid);
24049  if(retval == UA_STATUSCODE_GOOD)
24050  sub->publishJobIsRegistered = true;
24051  return retval;
24052 }
24053 
24055 Subscription_unregisterPublishJob(UA_Server *server, UA_Subscription *sub) {
24056  if(!sub->publishJobIsRegistered)
24057  return UA_STATUSCODE_GOOD;
24058  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24059  "Subscription %u | Unregister subscription publishing callback",
24060  sub->subscriptionID);
24061  sub->publishJobIsRegistered = false;
24062  return UA_Server_removeRepeatedJob(server, sub->publishJobGuid);
24063 }
24064 
24065 /* When the session has publish requests stored but the last subscription is
24066  deleted... Send out empty responses */
24067 void
24068 UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_NodeId *sessionToken) {
24069  /* Get session */
24070  UA_Session *session = UA_SessionManager_getSession(&server->sessionManager, sessionToken);
24071  UA_NodeId_delete(sessionToken);
24072 
24073  /* No session or there are remaining subscriptions */
24074  if(!session || LIST_FIRST(&session->serverSubscriptions))
24075  return;
24076 
24077  /* Send a response for every queued request */
24078  UA_PublishResponseEntry *pre;
24079  while((pre = SIMPLEQ_FIRST(&session->responseQueue))) {
24080  SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry);
24081  UA_PublishResponse *response = &pre->response;
24084  UA_SecureChannel_sendBinaryMessage(session->channel, pre->requestId, response,
24086  UA_PublishResponse_deleteMembers(response);
24087  UA_free(pre);
24088  }
24089 }
24090 
24091 #endif /* UA_ENABLE_SUBSCRIPTIONS */
24092 
24093 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_subscription.c" ***********************************/
24094 
24095 /* This Source Code Form is subject to the terms of the Mozilla Public
24096 * License, v. 2.0. If a copy of the MPL was not distributed with this
24097 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
24098 
24099 
24100 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
24101 
24102 #define UA_BOUNDEDVALUE_SETWBOUNDS(BOUNDS, SRC, DST) { \
24103  if(SRC > BOUNDS.max) DST = BOUNDS.max; \
24104  else if(SRC < BOUNDS.min) DST = BOUNDS.min; \
24105  else DST = SRC; \
24106  }
24107 
24108 static void
24109 setSubscriptionSettings(UA_Server *server, UA_Subscription *subscription,
24110  UA_Double requestedPublishingInterval,
24111  UA_UInt32 requestedLifetimeCount,
24112  UA_UInt32 requestedMaxKeepAliveCount,
24113  UA_UInt32 maxNotificationsPerPublish, UA_Byte priority) {
24114  /* deregister the job if required */
24115  UA_StatusCode retval = Subscription_unregisterPublishJob(server, subscription);
24116  if(retval != UA_STATUSCODE_GOOD)
24117  UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, "Subscription %u | "
24118  "Could not unregister publish job with error code 0x%08x",
24119  subscription->subscriptionID, retval);
24120 
24121  /* re-parameterize the subscription */
24122  subscription->publishingInterval = requestedPublishingInterval;
24123  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.publishingIntervalLimits,
24124  requestedPublishingInterval, subscription->publishingInterval);
24125  /* check for nan*/
24126  if(requestedPublishingInterval != requestedPublishingInterval)
24127  subscription->publishingInterval = server->config.publishingIntervalLimits.min;
24128  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.keepAliveCountLimits,
24129  requestedMaxKeepAliveCount, subscription->maxKeepAliveCount);
24130  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.lifeTimeCountLimits,
24131  requestedLifetimeCount, subscription->lifeTimeCount);
24132  if(subscription->lifeTimeCount < 3 * subscription->maxKeepAliveCount)
24133  subscription->lifeTimeCount = 3 * subscription->maxKeepAliveCount;
24134  subscription->notificationsPerPublish = maxNotificationsPerPublish;
24135  if(maxNotificationsPerPublish == 0 ||
24136  maxNotificationsPerPublish > server->config.maxNotificationsPerPublish)
24137  subscription->notificationsPerPublish = server->config.maxNotificationsPerPublish;
24138  subscription->priority = priority;
24139 
24140  retval = Subscription_registerPublishJob(server, subscription);
24141  if(retval != UA_STATUSCODE_GOOD)
24142  UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, "Subscription %u | "
24143  "Could not register publish job with error code 0x%08x",
24144  subscription->subscriptionID, retval);
24145 }
24146 
24147 void
24148 Service_CreateSubscription(UA_Server *server, UA_Session *session,
24149  const UA_CreateSubscriptionRequest *request,
24150  UA_CreateSubscriptionResponse *response) {
24151  /* Create the subscription */
24152  UA_Subscription *newSubscription = UA_Subscription_new(session, response->subscriptionId);
24153  if(!newSubscription) {
24154  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24155  "Processing CreateSubscriptionRequest failed");
24157  return;
24158  }
24159  newSubscription->subscriptionID = UA_Session_getUniqueSubscriptionID(session);
24160  UA_Session_addSubscription(session, newSubscription);
24161 
24162  /* Set the subscription parameters */
24163  newSubscription->publishingEnabled = request->publishingEnabled;
24164  setSubscriptionSettings(server, newSubscription, request->requestedPublishingInterval,
24166  request->maxNotificationsPerPublish, request->priority);
24167  newSubscription->currentKeepAliveCount = newSubscription->maxKeepAliveCount; /* set settings first */
24168 
24169  /* Prepare the response */
24170  response->subscriptionId = newSubscription->subscriptionID;
24171  response->revisedPublishingInterval = newSubscription->publishingInterval;
24172  response->revisedLifetimeCount = newSubscription->lifeTimeCount;
24173  response->revisedMaxKeepAliveCount = newSubscription->maxKeepAliveCount;
24174 
24175  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24176  "CreateSubscriptionRequest: Created Subscription %u "
24177  "with a publishing interval of %f ms", response->subscriptionId,
24178  newSubscription->publishingInterval);
24179 }
24180 
24181 void
24182 Service_ModifySubscription(UA_Server *server, UA_Session *session,
24183  const UA_ModifySubscriptionRequest *request,
24184  UA_ModifySubscriptionResponse *response) {
24185  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24186  "Processing ModifySubscriptionRequest");
24187  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24188  if(!sub) {
24190  return;
24191  }
24192 
24193  setSubscriptionSettings(server, sub, request->requestedPublishingInterval,
24195  request->maxNotificationsPerPublish, request->priority);
24196  sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */
24197  response->revisedPublishingInterval = sub->publishingInterval;
24198  response->revisedLifetimeCount = sub->lifeTimeCount;
24199  response->revisedMaxKeepAliveCount = sub->maxKeepAliveCount;
24200 }
24201 
24202 void
24203 Service_SetPublishingMode(UA_Server *server, UA_Session *session,
24204  const UA_SetPublishingModeRequest *request,
24205  UA_SetPublishingModeResponse *response) {
24206  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24207  "Processing SetPublishingModeRequest");
24208  if(request->subscriptionIdsSize <= 0) {
24210  return;
24211  }
24212 
24213  size_t size = request->subscriptionIdsSize;
24214  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_STATUSCODE]);
24215  if(!response->results) {
24217  return;
24218  }
24219 
24220  response->resultsSize = size;
24221  for(size_t i = 0; i < size; ++i) {
24222  UA_Subscription *sub =
24223  UA_Session_getSubscriptionByID(session, request->subscriptionIds[i]);
24224  if(!sub) {
24226  continue;
24227  }
24228  if(sub->publishingEnabled != request->publishingEnabled) {
24229  sub->publishingEnabled = request->publishingEnabled;
24230  sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */
24231  }
24232  }
24233 }
24234 
24235 static void
24236 setMonitoredItemSettings(UA_Server *server, UA_MonitoredItem *mon,
24237  UA_MonitoringMode monitoringMode,
24238  const UA_MonitoringParameters *params) {
24239  MonitoredItem_unregisterSampleJob(server, mon);
24240  mon->monitoringMode = monitoringMode;
24241 
24242  /* ClientHandle */
24243  mon->clientHandle = params->clientHandle;
24244 
24245  /* SamplingInterval */
24246  UA_Double samplingInterval = params->samplingInterval;
24247  if(mon->attributeID == UA_ATTRIBUTEID_VALUE) {
24248  const UA_VariableNode *vn = (const UA_VariableNode*)
24249  UA_NodeStore_get(server->nodestore, &mon->monitoredNodeId);
24250  if(vn && vn->nodeClass == UA_NODECLASS_VARIABLE &&
24251  samplingInterval < vn->minimumSamplingInterval)
24252  samplingInterval = vn->minimumSamplingInterval;
24253  } else if(mon->attributeID == UA_ATTRIBUTEID_EVENTNOTIFIER) {
24254  /* TODO: events should not need a samplinginterval */
24255  samplingInterval = 10000.0f; // 10 seconds to reduce the load
24256  }
24257  mon->samplingInterval = samplingInterval;
24258  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.samplingIntervalLimits,
24259  samplingInterval, mon->samplingInterval);
24260  if(samplingInterval != samplingInterval) /* Check for nan */
24261  mon->samplingInterval = server->config.samplingIntervalLimits.min;
24262 
24263  /* Filter */
24264  if(params->filter.encoding != UA_EXTENSIONOBJECT_DECODED ||
24266  /* Default: Trigger only on the value and the statuscode */
24267  mon->trigger = UA_DATACHANGETRIGGER_STATUSVALUE;
24268  } else {
24269  UA_DataChangeFilter *filter = params->filter.content.decoded.data;
24270  mon->trigger = filter->trigger;
24271  }
24272 
24273  /* QueueSize */
24274  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.queueSizeLimits,
24275  params->queueSize, mon->maxQueueSize);
24276 
24277  /* DiscardOldest */
24278  mon->discardOldest = params->discardOldest;
24279 
24280  /* Register sample job if reporting is enabled */
24281  if(monitoringMode == UA_MONITORINGMODE_REPORTING)
24282  MonitoredItem_registerSampleJob(server, mon);
24283 }
24284 
24285 static const UA_String binaryEncoding = {sizeof("Default Binary")-1, (UA_Byte*)"Default Binary"};
24286 /* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */
24287 
24288 static void
24289 Service_CreateMonitoredItems_single(UA_Server *server, UA_Session *session,
24290  UA_Subscription *sub,
24291  const UA_TimestampsToReturn timestampsToReturn,
24292  const UA_MonitoredItemCreateRequest *request,
24293  UA_MonitoredItemCreateResult *result) {
24294  /* Make an example read to get errors in the itemToMonitor. Allow return
24295  * codes "good" and "uncertain", as well as a list of statuscodes that might
24296  * be repaired inside the data source. */
24297  UA_DataValue v;
24298  UA_DataValue_init(&v);
24299  Service_Read_single(server, session, timestampsToReturn, &request->itemToMonitor, &v);
24300  if(v.hasStatus && (v.status >> 30) > 1 &&
24304  result->statusCode = v.status;
24305  UA_DataValue_deleteMembers(&v);
24306  return;
24307  }
24308  UA_DataValue_deleteMembers(&v);
24309 
24310  /* Check if the encoding is supported */
24311  if(request->itemToMonitor.dataEncoding.name.length > 0 &&
24312  (!UA_String_equal(&binaryEncoding, &request->itemToMonitor.dataEncoding.name) ||
24313  request->itemToMonitor.dataEncoding.namespaceIndex != 0)) {
24315  return;
24316  }
24317 
24318  /* Check if the encoding is set for a value */
24320  request->itemToMonitor.dataEncoding.name.length > 0) {
24322  return;
24323  }
24324 
24325  /* Create the monitoreditem */
24327  if(!newMon) {
24329  return;
24330  }
24331  UA_StatusCode retval = UA_NodeId_copy(&request->itemToMonitor.nodeId,
24332  &newMon->monitoredNodeId);
24333  if(retval != UA_STATUSCODE_GOOD) {
24334  result->statusCode = retval;
24335  MonitoredItem_delete(server, newMon);
24336  return;
24337  }
24338  newMon->subscription = sub;
24339  newMon->attributeID = request->itemToMonitor.attributeId;
24340  newMon->itemId = ++(sub->lastMonitoredItemId);
24341  newMon->timestampsToReturn = timestampsToReturn;
24342  setMonitoredItemSettings(server, newMon, request->monitoringMode,
24343  &request->requestedParameters);
24344  LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry);
24345 
24346  /* Create the first sample */
24348  UA_MoniteredItem_SampleCallback(server, newMon);
24349 
24350  /* Prepare the response */
24351  UA_String_copy(&request->itemToMonitor.indexRange, &newMon->indexRange);
24352  result->revisedSamplingInterval = newMon->samplingInterval;
24353  result->revisedQueueSize = newMon->maxQueueSize;
24354  result->monitoredItemId = newMon->itemId;
24355 }
24356 
24357 void
24358 Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
24359  const UA_CreateMonitoredItemsRequest *request,
24360  UA_CreateMonitoredItemsResponse *response) {
24361  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24362  "Processing CreateMonitoredItemsRequest");
24363 
24364  /* Check if the timestampstoreturn is valid */
24367  return;
24368  }
24369 
24370  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24371  if(!sub) {
24373  return;
24374  }
24375 
24376  /* Reset the subscription lifetime */
24377  sub->currentLifetimeCount = 0;
24378  if(request->itemsToCreateSize <= 0) {
24380  return;
24381  }
24382 
24383  response->results = UA_Array_new(request->itemsToCreateSize,
24385  if(!response->results) {
24387  return;
24388  }
24389  response->resultsSize = request->itemsToCreateSize;
24390 
24391  for(size_t i = 0; i < request->itemsToCreateSize; ++i)
24392  Service_CreateMonitoredItems_single(server, session, sub, request->timestampsToReturn,
24393  &request->itemsToCreate[i], &response->results[i]);
24394 }
24395 
24396 static void
24397 Service_ModifyMonitoredItems_single(UA_Server *server, UA_Session *session, UA_Subscription *sub,
24398  const UA_MonitoredItemModifyRequest *request,
24399  UA_MonitoredItemModifyResult *result) {
24401  if(!mon) {
24403  return;
24404  }
24405 
24406  setMonitoredItemSettings(server, mon, mon->monitoringMode,
24407  &request->requestedParameters);
24408  result->revisedSamplingInterval = mon->samplingInterval;
24409  result->revisedQueueSize = mon->maxQueueSize;
24410 }
24411 
24412 void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
24413  const UA_ModifyMonitoredItemsRequest *request,
24414  UA_ModifyMonitoredItemsResponse *response) {
24415  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24416  "Processing ModifyMonitoredItemsRequest");
24417 
24418  /* check if the timestampstoreturn is valid */
24421  return;
24422  }
24423 
24424  /* Get the subscription */
24425  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24426  if(!sub) {
24428  return;
24429  }
24430 
24431  /* Reset the subscription lifetime */
24432  sub->currentLifetimeCount = 0;
24433  if(request->itemsToModifySize <= 0) {
24435  return;
24436  }
24437 
24438  response->results = UA_Array_new(request->itemsToModifySize,
24440  if(!response->results) {
24442  return;
24443  }
24444  response->resultsSize = request->itemsToModifySize;
24445 
24446  for(size_t i = 0; i < request->itemsToModifySize; ++i)
24447  Service_ModifyMonitoredItems_single(server, session, sub, &request->itemsToModify[i],
24448  &response->results[i]);
24449 
24450 }
24451 
24452 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
24453  const UA_SetMonitoringModeRequest *request,
24454  UA_SetMonitoringModeResponse *response) {
24455  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing SetMonitoringMode");
24456  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24457  if(!sub) {
24459  return;
24460  }
24461 
24462  if(request->monitoredItemIdsSize == 0) {
24464  return;
24465  }
24466 
24468  if(!response->results) {
24470  return;
24471  }
24472  response->resultsSize = request->monitoredItemIdsSize;
24473 
24474  for(size_t i = 0; i < response->resultsSize; ++i) {
24475  UA_MonitoredItem *mon =
24477  if(!mon) {
24479  continue;
24480  }
24481  if(request->monitoringMode == mon->monitoringMode)
24482  continue;
24483  mon->monitoringMode = request->monitoringMode;
24484  if(mon->monitoringMode == UA_MONITORINGMODE_REPORTING)
24485  MonitoredItem_registerSampleJob(server, mon);
24486  else
24487  MonitoredItem_unregisterSampleJob(server, mon);
24488  }
24489 }
24490 
24491 
24492 void
24493 Service_Publish(UA_Server *server, UA_Session *session,
24494  const UA_PublishRequest *request, UA_UInt32 requestId) {
24495  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing PublishRequest");
24497  /* Return an error if the session has no subscription */
24498  if(LIST_EMPTY(&session->serverSubscriptions)) {
24500  goto send_error;
24501  }
24502 
24503  UA_PublishResponseEntry *entry = UA_malloc(sizeof(UA_PublishResponseEntry));
24504  if(!entry) {
24506  goto send_error;
24507  }
24508  entry->requestId = requestId;
24509 
24510  /* Build the response */
24511  UA_PublishResponse *response = &entry->response;
24512  UA_PublishResponse_init(response);
24514  if(request->subscriptionAcknowledgementsSize > 0) {
24517  if(!response->results) {
24518  UA_free(entry);
24520  goto send_error;
24521  }
24522  response->resultsSize = request->subscriptionAcknowledgementsSize;
24523  }
24524 
24525  /* Delete Acknowledged Subscription Messages */
24526  for(size_t i = 0; i < request->subscriptionAcknowledgementsSize; ++i) {
24528  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, ack->subscriptionId);
24529  if(!sub) {
24531  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24532  "Cannot process acknowledgements subscription %u",
24533  ack->subscriptionId);
24534  continue;
24535  }
24536  /* Remove the acked transmission from the retransmission queue */
24538  }
24539 
24540  /* Queue the publish response */
24541  SIMPLEQ_INSERT_TAIL(&session->responseQueue, entry, listEntry);
24542  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Queued a publication message",
24544 
24545  /* Answer immediately to a late subscription */
24546  UA_Subscription *immediate;
24547  LIST_FOREACH(immediate, &session->serverSubscriptions, listEntry) {
24548  if(immediate->state == UA_SUBSCRIPTIONSTATE_LATE) {
24549  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
24550  "Response on a late subscription", immediate->subscriptionID,
24552  UA_Subscription_publishCallback(server, immediate);
24553  break;
24554  }
24555  }
24556  return;
24557 
24558  UA_PublishResponse err_response;
24559  send_error:
24560  UA_PublishResponse_init(&err_response);
24561  err_response.responseHeader.requestHandle = request->requestHeader.requestHandle;
24562  err_response.responseHeader.timestamp = UA_DateTime_now();
24563  err_response.responseHeader.serviceResult = retval;
24564  UA_assert(err_response.responseHeader.requestHandle != 0);
24565  UA_SecureChannel_sendBinaryMessage(session->channel, requestId, &err_response,
24567 }
24568 
24569 void
24570 Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
24571  const UA_DeleteSubscriptionsRequest *request,
24572  UA_DeleteSubscriptionsResponse *response) {
24573  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24574  "Processing DeleteSubscriptionsRequest");
24575 
24576  if(request->subscriptionIdsSize == 0) {
24578  return;
24579  }
24580 
24581  response->results = UA_malloc(sizeof(UA_StatusCode) * request->subscriptionIdsSize);
24582  if(!response->results) {
24584  return;
24585  }
24586  response->resultsSize = request->subscriptionIdsSize;
24587 
24588  for(size_t i = 0; i < request->subscriptionIdsSize; ++i) {
24589  response->results[i] = UA_Session_deleteSubscription(server, session, request->subscriptionIds[i]);
24590  if(response->results[i] == UA_STATUSCODE_GOOD) {
24591  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
24592  "Subscription deleted", request->subscriptionIds[i]);
24593  } else {
24594  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Deleting Subscription with Id "
24595  "%u failed with error code 0x%08x", request->subscriptionIds[i],
24596  response->results[i]);
24597  }
24598  }
24599 
24600  /* Send dangling publish responses in a delayed job if the last subscription
24601  was removed */
24602  if(LIST_FIRST(&session->serverSubscriptions))
24603  return;
24604  UA_NodeId *sessionToken = UA_NodeId_new();
24605  if(!sessionToken)
24606  return;
24607  UA_NodeId_copy(&session->authenticationToken, sessionToken);
24608  UA_Server_delayedCallback(server, (UA_ServerCallback)UA_Subscription_answerPublishRequestsNoSubscription,
24609  sessionToken);
24610 }
24611 
24612 void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
24613  const UA_DeleteMonitoredItemsRequest *request,
24614  UA_DeleteMonitoredItemsResponse *response) {
24615  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24616  "Processing DeleteMonitoredItemsRequest");
24617 
24618  if(request->monitoredItemIdsSize == 0) {
24620  return;
24621  }
24622 
24623  /* Get the subscription */
24624  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24625  if(!sub) {
24627  return;
24628  }
24629 
24630  /* Reset the subscription lifetime */
24631  sub->currentLifetimeCount = 0;
24632  response->results = UA_malloc(sizeof(UA_StatusCode) * request->monitoredItemIdsSize);
24633  if(!response->results) {
24635  return;
24636  }
24637  response->resultsSize = request->monitoredItemIdsSize;
24638 
24639  for(size_t i = 0; i < request->monitoredItemIdsSize; ++i)
24640  response->results[i] = UA_Subscription_deleteMonitoredItem(server, sub, request->monitoredItemIds[i]);
24641 }
24642 
24643 void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request,
24644  UA_RepublishResponse *response) {
24645  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RepublishRequest");
24646  /* get the subscription */
24647  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24648  if (!sub) {
24650  return;
24651  }
24652 
24653  /* Reset the subscription lifetime */
24654  sub->currentLifetimeCount = 0;
24655 
24656  /* Find the notification in the retransmission queue */
24658  TAILQ_FOREACH(entry, &sub->retransmissionQueue, listEntry) {
24659  if(entry->message.sequenceNumber == request->retransmitSequenceNumber)
24660  break;
24661  }
24662  if(entry)
24663  response->responseHeader.serviceResult =
24664  UA_NotificationMessage_copy(&entry->message, &response->notificationMessage);
24665  else
24667 }
24668 
24669 #endif /* UA_ENABLE_SUBSCRIPTIONS */
24670 
24671 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client.c" ***********************************/
24672 
24673 /* This Source Code Form is subject to the terms of the Mozilla Public
24674  * License, v. 2.0. If a copy of the MPL was not distributed with this
24675  * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
24676 
24677 
24678 /*********************/
24679 /* Create and Delete */
24680 /*********************/
24681 
24682 static void UA_Client_init(UA_Client* client, UA_ClientConfig config) {
24683  memset(client, 0, sizeof(UA_Client));
24684  client->channel.connection = &client->connection;
24685  client->config = config;
24686 }
24687 
24688 UA_Client * UA_Client_new(UA_ClientConfig config) {
24689  UA_Client *client = (UA_Client*)UA_calloc(1, sizeof(UA_Client));
24690  if(!client)
24691  return NULL;
24692  UA_Client_init(client, config);
24693  return client;
24694 }
24695 
24696 static void UA_Client_deleteMembers(UA_Client* client) {
24697  UA_Client_disconnect(client);
24700  if(client->endpointUrl.data)
24701  UA_String_deleteMembers(&client->endpointUrl);
24702  UA_UserTokenPolicy_deleteMembers(&client->token);
24703  UA_NodeId_deleteMembers(&client->authenticationToken);
24704  if(client->username.data)
24705  UA_String_deleteMembers(&client->username);
24706  if(client->password.data)
24707  UA_String_deleteMembers(&client->password);
24708 #ifdef UA_ENABLE_SUBSCRIPTIONS
24709  UA_Client_NotificationsAckNumber *n, *tmp;
24710  LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) {
24711  LIST_REMOVE(n, listEntry);
24712  UA_free(n);
24713  }
24714  UA_Client_Subscription *sub, *tmps;
24715  LIST_FOREACH_SAFE(sub, &client->subscriptions, listEntry, tmps)
24716  UA_Client_Subscriptions_forceDelete(client, sub); /* force local removal */
24717 #endif
24718 }
24719 
24721  UA_Client_deleteMembers(client);
24722  UA_Client_init(client, client->config);
24723 }
24724 
24726  UA_Client_deleteMembers(client);
24727  UA_free(client);
24728 }
24729 
24730 UA_ClientState UA_Client_getState(UA_Client *client) {
24731  if(!client)
24732  return UA_CLIENTSTATE_ERRORED;
24733  return client->state;
24734 }
24735 
24736 /*************************/
24737 /* Manage the Connection */
24738 /*************************/
24739 
24740 #define UA_MINMESSAGESIZE 8192
24741 
24742 static UA_StatusCode
24743 HelAckHandshake(UA_Client *client) {
24744  /* Get a buffer */
24745  UA_ByteString message;
24746  UA_Connection *conn = &client->connection;
24747  UA_StatusCode retval = conn->getSendBuffer(conn, UA_MINMESSAGESIZE, &message);
24748  if(retval != UA_STATUSCODE_GOOD)
24749  return retval;
24750 
24751  /* Prepare the HEL message and encode at offset 8 */
24752  UA_TcpHelloMessage hello;
24753  UA_String_copy(&client->endpointUrl, &hello.endpointUrl); /* must be less than 4096 bytes */
24754  hello.maxChunkCount = conn->localConf.maxChunkCount;
24755  hello.maxMessageSize = conn->localConf.maxMessageSize;
24758  hello.sendBufferSize = conn->localConf.sendBufferSize;
24759 
24760  size_t offset = 8;
24761  retval = UA_TcpHelloMessage_encodeBinary(&hello, &message, &offset);
24762  UA_TcpHelloMessage_deleteMembers(&hello);
24763 
24764  /* Encode the message header at offset 0 */
24765  UA_TcpMessageHeader messageHeader;
24767  messageHeader.messageSize = (UA_UInt32)offset;
24768  offset = 0;
24769  retval |= UA_TcpMessageHeader_encodeBinary(&messageHeader, &message, &offset);
24770  if(retval != UA_STATUSCODE_GOOD) {
24771  conn->releaseSendBuffer(conn, &message);
24772  return retval;
24773  }
24774 
24775  /* Send the HEL message */
24776  message.length = messageHeader.messageSize;
24777  retval = conn->send(conn, &message);
24778  if(retval != UA_STATUSCODE_GOOD) {
24779  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
24780  "Sending HEL failed");
24781  return retval;
24782  }
24783  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK,
24784  "Sent HEL message");
24785 
24786  /* Loop until we have a complete chunk */
24788  UA_Boolean realloced = false;
24789  retval = UA_Connection_receiveChunksBlocking(conn, &reply, &realloced,
24790  client->config.timeout);
24791  if(retval != UA_STATUSCODE_GOOD) {
24792  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
24793  "Receiving ACK message failed");
24794  return retval;
24795  }
24796 
24797  /* Decode the message */
24798  offset = 0;
24799  UA_TcpAcknowledgeMessage ackMessage;
24800  retval = UA_TcpMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
24801  retval |= UA_TcpAcknowledgeMessage_decodeBinary(&reply, &offset, &ackMessage);
24802 
24803  /* Free the message buffer */
24804  if(!realloced)
24805  conn->releaseRecvBuffer(conn, &reply);
24806  else
24807  UA_ByteString_deleteMembers(&reply);
24808 
24809  /* Store remote connection settings and adjust local configuration to not
24810  exceed the limits */
24811  if(retval == UA_STATUSCODE_GOOD) {
24812  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK, "Received ACK message");
24813  conn->remoteConf.maxChunkCount = ackMessage.maxChunkCount; /* may be zero -> unlimited */
24814  conn->remoteConf.maxMessageSize = ackMessage.maxMessageSize; /* may be zero -> unlimited */
24815  conn->remoteConf.protocolVersion = ackMessage.protocolVersion;
24816  conn->remoteConf.sendBufferSize = ackMessage.sendBufferSize;
24817  conn->remoteConf.recvBufferSize = ackMessage.receiveBufferSize;
24823  } else {
24824  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Decoding ACK message failed");
24825  }
24826  UA_TcpAcknowledgeMessage_deleteMembers(&ackMessage);
24827 
24828  return retval;
24829 }
24830 
24831 static UA_StatusCode
24832 SecureChannelHandshake(UA_Client *client, UA_Boolean renew) {
24833  /* Check if sc is still valid */
24834  if(renew && client->nextChannelRenewal - UA_DateTime_nowMonotonic() > 0)
24835  return UA_STATUSCODE_GOOD;
24836 
24837  UA_Connection *conn = &client->connection;
24838  if(conn->state != UA_CONNECTION_ESTABLISHED)
24840 
24841  UA_ByteString message;
24842  UA_StatusCode retval = conn->getSendBuffer(conn, conn->remoteConf.recvBufferSize, &message);
24843  if(retval != UA_STATUSCODE_GOOD)
24844  return retval;
24845 
24846  /* Jump over the messageHeader that will be encoded last */
24847  size_t offset = 12;
24848 
24849  /* Encode the Asymmetric Security Header */
24851  UA_AsymmetricAlgorithmSecurityHeader_init(&asymHeader);
24852  asymHeader.securityPolicyUri = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
24853  retval = UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(&asymHeader, &message, &offset);
24854 
24855  /* Encode the sequence header */
24856  UA_SequenceHeader seqHeader;
24857  seqHeader.sequenceNumber = ++client->channel.sendSequenceNumber;
24858  seqHeader.requestId = ++client->requestId;
24859  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &message, &offset);
24860 
24861  /* Encode the NodeId of the OpenSecureChannel Service */
24862  UA_NodeId requestType =
24863  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST].binaryEncodingId);
24864  retval |= UA_NodeId_encodeBinary(&requestType, &message, &offset);
24865 
24866  /* Encode the OpenSecureChannelRequest */
24867  UA_OpenSecureChannelRequest opnSecRq;
24868  UA_OpenSecureChannelRequest_init(&opnSecRq);
24871  if(renew) {
24873  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24874  "Requesting to renew the SecureChannel");
24875  } else {
24877  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24878  "Requesting to open a SecureChannel");
24879  }
24881  opnSecRq.clientNonce = client->channel.clientNonce;
24882  opnSecRq.requestedLifetime = client->config.secureChannelLifeTime;
24883  retval |= UA_OpenSecureChannelRequest_encodeBinary(&opnSecRq, &message, &offset);
24884 
24885  /* Encode the message header at the beginning */
24886  UA_SecureConversationMessageHeader messageHeader;
24888  messageHeader.messageHeader.messageSize = (UA_UInt32)offset;
24889  if(renew)
24890  messageHeader.secureChannelId = client->channel.securityToken.channelId;
24891  else
24892  messageHeader.secureChannelId = 0;
24893  offset = 0;
24894  retval |= UA_SecureConversationMessageHeader_encodeBinary(&messageHeader, &message, &offset);
24895 
24896  /* Clean up and return if encoding the message failed */
24897  if(retval != UA_STATUSCODE_GOOD) {
24898  client->connection.releaseSendBuffer(&client->connection, &message);
24899  return retval;
24900  }
24901 
24902  /* Send the message */
24903  message.length = messageHeader.messageHeader.messageSize;
24904  retval = conn->send(conn, &message);
24905  if(retval != UA_STATUSCODE_GOOD)
24906  return retval;
24907 
24908  /* Receive the response */
24910  UA_Boolean realloced = false;
24911  retval = UA_Connection_receiveChunksBlocking(conn, &reply, &realloced,
24912  client->config.timeout);
24913  if(retval != UA_STATUSCODE_GOOD) {
24914  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24915  "Receiving OpenSecureChannelResponse failed");
24916  return retval;
24917  }
24918 
24919  /* Decode the header */
24920  offset = 0;
24921  retval = UA_SecureConversationMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
24922  retval |= UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(&reply, &offset, &asymHeader);
24923  retval |= UA_SequenceHeader_decodeBinary(&reply, &offset, &seqHeader);
24924  retval |= UA_NodeId_decodeBinary(&reply, &offset, &requestType);
24925  UA_NodeId expectedRequest =
24926  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE].binaryEncodingId);
24927  if(retval != UA_STATUSCODE_GOOD || !UA_NodeId_equal(&requestType, &expectedRequest)) {
24928  UA_ByteString_deleteMembers(&reply);
24929  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
24930  UA_NodeId_deleteMembers(&requestType);
24931  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
24932  "Reply answers the wrong request. Expected OpenSecureChannelResponse.");
24934  }
24935 
24936  /* Save the sequence number from server */
24937  client->channel.receiveSequenceNumber = seqHeader.sequenceNumber;
24938 
24939  /* Decode the response */
24941  retval = UA_OpenSecureChannelResponse_decodeBinary(&reply, &offset, &response);
24942 
24943  /* Free the message */
24944  if(!realloced)
24945  conn->releaseRecvBuffer(conn, &reply);
24946  else
24947  UA_ByteString_deleteMembers(&reply);
24948 
24949  /* Results in either the StatusCode of decoding or the service */
24950  retval |= response.responseHeader.serviceResult;
24951 
24952  if(retval == UA_STATUSCODE_GOOD) {
24953  /* Response.securityToken.revisedLifetime is UInt32 we need to cast it
24954  * to DateTime=Int64 we take 75% of lifetime to start renewing as
24955  * described in standard */
24958 
24959  /* Replace the old nonce */
24960  UA_ChannelSecurityToken_deleteMembers(&client->channel.securityToken);
24961  UA_ChannelSecurityToken_copy(&response.securityToken, &client->channel.securityToken);
24962  UA_ByteString_deleteMembers(&client->channel.serverNonce);
24963  UA_ByteString_copy(&response.serverNonce, &client->channel.serverNonce);
24964 
24965  if(renew)
24966  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24967  "SecureChannel renewed");
24968  else
24969  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24970  "SecureChannel opened");
24971  } else {
24972  if(renew)
24973  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24974  "SecureChannel could not be renewed "
24975  "with error code %s", UA_StatusCode_name(retval));
24976  else
24977  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24978  "SecureChannel could not be opened "
24979  "with error code %s", UA_StatusCode_name(retval));
24980  }
24981 
24982  /* Clean up */
24983  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
24984  UA_OpenSecureChannelResponse_deleteMembers(&response);
24985  return retval;
24986 }
24987 
24988 static UA_StatusCode
24989 ActivateSession(UA_Client *client) {
24990  UA_ActivateSessionRequest request;
24991  UA_ActivateSessionRequest_init(&request);
24992  request.requestHeader.requestHandle = ++client->requestHandle;
24994  request.requestHeader.timeoutHint = 600000;
24995 
24996  //manual ExtensionObject encoding of the identityToken
24998  UA_AnonymousIdentityToken* identityToken = UA_AnonymousIdentityToken_new();
24999  UA_AnonymousIdentityToken_init(identityToken);
25000  UA_String_copy(&client->token.policyId, &identityToken->policyId);
25003  request.userIdentityToken.content.decoded.data = identityToken;
25004  } else {
25005  UA_UserNameIdentityToken* identityToken = UA_UserNameIdentityToken_new();
25006  UA_UserNameIdentityToken_init(identityToken);
25007  UA_String_copy(&client->token.policyId, &identityToken->policyId);
25008  UA_String_copy(&client->username, &identityToken->userName);
25009  UA_String_copy(&client->password, &identityToken->password);
25012  request.userIdentityToken.content.decoded.data = identityToken;
25013  }
25014 
25015  UA_ActivateSessionResponse response;
25018 
25019  if(response.responseHeader.serviceResult) {
25020  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25021  "ActivateSession failed with error code %s",
25022  UA_StatusCode_name(response.responseHeader.serviceResult));
25023  }
25024 
25025  UA_StatusCode retval = response.responseHeader.serviceResult;
25026  UA_ActivateSessionRequest_deleteMembers(&request);
25027  UA_ActivateSessionResponse_deleteMembers(&response);
25028  return retval;
25029 }
25030 
25031 /* Gets a list of endpoints. Memory is allocated for endpointDescription array */
25032 static UA_StatusCode
25033 GetEndpoints(UA_Client *client, size_t* endpointDescriptionsSize,
25034  UA_EndpointDescription** endpointDescriptions) {
25035  UA_GetEndpointsRequest request;
25036  UA_GetEndpointsRequest_init(&request);
25038  request.requestHeader.timeoutHint = 10000;
25039  // assume the endpointurl outlives the service call
25040  request.endpointUrl = client->endpointUrl;
25041 
25042  UA_GetEndpointsResponse response;
25043  UA_GetEndpointsResponse_init(&response);
25046 
25048  UA_StatusCode retval = response.responseHeader.serviceResult;
25049  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25050  "GetEndpointRequest failed with error code %s",
25051  UA_StatusCode_name(retval));
25052  UA_GetEndpointsResponse_deleteMembers(&response);
25053  return retval;
25054  }
25055  *endpointDescriptions = response.endpoints;
25056  *endpointDescriptionsSize = response.endpointsSize;
25057  response.endpoints = NULL;
25058  response.endpointsSize = 0;
25059  UA_GetEndpointsResponse_deleteMembers(&response);
25060  return UA_STATUSCODE_GOOD;
25061 }
25062 
25063 static UA_StatusCode
25064 EndpointsHandshake(UA_Client *client) {
25065  UA_EndpointDescription* endpointArray = NULL;
25066  size_t endpointArraySize = 0;
25067  UA_StatusCode retval = GetEndpoints(client, &endpointArraySize, &endpointArray);
25068  if(retval != UA_STATUSCODE_GOOD)
25069  return retval;
25070 
25071  UA_Boolean endpointFound = false;
25072  UA_Boolean tokenFound = false;
25073  UA_String securityNone = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
25074  UA_String binaryTransport = UA_STRING("http://opcfoundation.org/UA-Profile/"
25075  "Transport/uatcp-uasc-uabinary");
25076 
25077  //TODO: compare endpoint information with client->endpointUri
25078  for(size_t i = 0; i < endpointArraySize; ++i) {
25079  UA_EndpointDescription* endpoint = &endpointArray[i];
25080  /* look out for binary transport endpoints */
25081  /* Note: Siemens returns empty ProfileUrl, we will accept it as binary */
25082  if(endpoint->transportProfileUri.length != 0 &&
25083  !UA_String_equal(&endpoint->transportProfileUri, &binaryTransport))
25084  continue;
25085  /* look out for an endpoint without security */
25086  if(!UA_String_equal(&endpoint->securityPolicyUri, &securityNone))
25087  continue;
25088 
25089  /* endpoint with no security found */
25090  endpointFound = true;
25091 
25092  /* look for a user token policy with an anonymous token */
25093  for(size_t j = 0; j < endpoint->userIdentityTokensSize; ++j) {
25094  UA_UserTokenPolicy* userToken = &endpoint->userIdentityTokens[j];
25095 
25096  /* Usertokens also have a security policy... */
25097  if(userToken->securityPolicyUri.length > 0 &&
25098  !UA_String_equal(&userToken->securityPolicyUri, &securityNone))
25099  continue;
25100 
25101  /* UA_CLIENTAUTHENTICATION_NONE == UA_USERTOKENTYPE_ANONYMOUS
25102  * UA_CLIENTAUTHENTICATION_USERNAME == UA_USERTOKENTYPE_USERNAME
25103  * TODO: Check equivalence for other types when adding the support */
25104  if((int)client->authenticationMethod != (int)userToken->tokenType)
25105  continue;
25106 
25107  /* Endpoint with matching usertokenpolicy found */
25108  tokenFound = true;
25109  UA_UserTokenPolicy_copy(userToken, &client->token);
25110  break;
25111  }
25112  }
25113 
25114  UA_Array_delete(endpointArray, endpointArraySize,
25116 
25117  if(!endpointFound) {
25118  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25119  "No suitable endpoint found");
25121  } else if(!tokenFound) {
25122  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25123  "No suitable UserTokenPolicy found for the possible endpoints");
25125  }
25126  return retval;
25127 }
25128 
25129 static UA_StatusCode
25130 SessionHandshake(UA_Client *client) {
25131  UA_CreateSessionRequest request;
25132  UA_CreateSessionRequest_init(&request);
25133 
25135  request.requestHeader.timeoutHint = 10000;
25136  UA_ByteString_copy(&client->channel.clientNonce, &request.clientNonce);
25137  request.requestedSessionTimeout = 1200000;
25139  UA_String_copy(&client->endpointUrl, &request.endpointUrl);
25140 
25141  UA_CreateSessionResponse response;
25142  UA_CreateSessionResponse_init(&response);
25145 
25146  UA_NodeId_copy(&response.authenticationToken, &client->authenticationToken);
25147 
25148  UA_StatusCode retval = response.responseHeader.serviceResult;
25149  UA_CreateSessionRequest_deleteMembers(&request);
25150  UA_CreateSessionResponse_deleteMembers(&response);
25151  return retval;
25152 }
25153 
25154 static UA_StatusCode
25155 CloseSession(UA_Client *client) {
25156  UA_CloseSessionRequest request;
25157  UA_CloseSessionRequest_init(&request);
25158 
25160  request.requestHeader.timeoutHint = 10000;
25161  request.deleteSubscriptions = true;
25162  UA_CloseSessionResponse response;
25165 
25166  UA_StatusCode retval = response.responseHeader.serviceResult;
25167  UA_CloseSessionRequest_deleteMembers(&request);
25168  UA_CloseSessionResponse_deleteMembers(&response);
25169  return retval;
25170 }
25171 
25172 static UA_StatusCode
25173 CloseSecureChannel(UA_Client *client) {
25174  UA_SecureChannel *channel = &client->channel;
25176  UA_CloseSecureChannelRequest_init(&request);
25177  request.requestHeader.requestHandle = ++client->requestHandle;
25179  request.requestHeader.timeoutHint = 10000;
25180  UA_NodeId_copy(&client->authenticationToken,
25182 
25185  msgHeader.secureChannelId = channel->securityToken.channelId;
25186 
25188  symHeader.tokenId = channel->securityToken.tokenId;
25189 
25190  UA_SequenceHeader seqHeader;
25191  seqHeader.sequenceNumber = ++channel->sendSequenceNumber;
25192  seqHeader.requestId = ++client->requestId;
25193 
25194  UA_NodeId typeId =
25195  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST].binaryEncodingId);
25196 
25197  UA_ByteString message;
25198  UA_Connection *conn = &client->connection;
25199  UA_StatusCode retval = conn->getSendBuffer(conn, conn->remoteConf.recvBufferSize, &message);
25200  if(retval != UA_STATUSCODE_GOOD){
25201  UA_CloseSecureChannelRequest_deleteMembers(&request);
25202  return retval;
25203  }
25204 
25205  size_t offset = 12;
25206  retval |= UA_SymmetricAlgorithmSecurityHeader_encodeBinary(&symHeader, &message, &offset);
25207  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &message, &offset);
25208  retval |= UA_NodeId_encodeBinary(&typeId, &message, &offset);
25210  NULL, NULL, &message, &offset);
25211 
25212  msgHeader.messageHeader.messageSize = (UA_UInt32)offset;
25213  offset = 0;
25214  retval |= UA_SecureConversationMessageHeader_encodeBinary(&msgHeader, &message, &offset);
25215 
25216  if(retval == UA_STATUSCODE_GOOD) {
25217  message.length = msgHeader.messageHeader.messageSize;
25218  retval = conn->send(conn, &message);
25219  } else {
25220  conn->releaseSendBuffer(conn, &message);
25221  }
25222  conn->close(conn);
25223  UA_CloseSecureChannelRequest_deleteMembers(&request);
25224  return retval;
25225 }
25226 
25228 UA_Client_getEndpoints(UA_Client *client, const char *serverUrl,
25229  size_t* endpointDescriptionsSize,
25230  UA_EndpointDescription** endpointDescriptions) {
25231  if(client->state == UA_CLIENTSTATE_CONNECTED)
25232  return UA_STATUSCODE_GOOD;
25233  if(client->state == UA_CLIENTSTATE_ERRORED)
25234  UA_Client_reset(client);
25235 
25236 
25238  client->connection =
25239  client->config.connectionFunc(UA_ConnectionConfig_standard, serverUrl,
25240  client->config.logger);
25241  if(client->connection.state != UA_CONNECTION_OPENING) {
25243  goto cleanup;
25244  }
25245 
25246  client->endpointUrl = UA_STRING_ALLOC(serverUrl);
25247  if(!client->endpointUrl.data) {
25249  goto cleanup;
25250  }
25251 
25252  client->connection.localConf = client->config.localConnectionConfig;
25253  retval = HelAckHandshake(client);
25254  if(retval == UA_STATUSCODE_GOOD)
25255  retval = SecureChannelHandshake(client, false);
25256  if(retval == UA_STATUSCODE_GOOD)
25257  retval = GetEndpoints(client, endpointDescriptionsSize, endpointDescriptions);
25258 
25259  /* always cleanup */
25260  cleanup:
25261  UA_Client_disconnect(client);
25262  UA_Client_reset(client);
25263  return retval;
25264 }
25265 
25267 UA_Client_connect_username(UA_Client *client, const char *endpointUrl,
25268  const char *username, const char *password){
25270  client->username = UA_STRING_ALLOC(username);
25271  client->password = UA_STRING_ALLOC(password);
25272  return UA_Client_connect(client, endpointUrl);
25273 }
25274 
25275 
25277 UA_Client_connect(UA_Client *client, const char *endpointUrl) {
25278  if(client->state == UA_CLIENTSTATE_CONNECTED)
25279  return UA_STATUSCODE_GOOD;
25280  if(client->state == UA_CLIENTSTATE_ERRORED) {
25281  UA_Client_reset(client);
25282  }
25283 
25285  client->connection =
25286  client->config.connectionFunc(UA_ConnectionConfig_standard,
25287  endpointUrl, client->config.logger);
25288  if(client->connection.state != UA_CONNECTION_OPENING) {
25290  goto cleanup;
25291  }
25292 
25293  client->endpointUrl = UA_STRING_ALLOC(endpointUrl);
25294  if(!client->endpointUrl.data) {
25296  goto cleanup;
25297  }
25298 
25299  client->connection.localConf = client->config.localConnectionConfig;
25300  retval = HelAckHandshake(client);
25301  if(retval == UA_STATUSCODE_GOOD)
25302  retval = SecureChannelHandshake(client, false);
25303  if(retval == UA_STATUSCODE_GOOD)
25304  retval = EndpointsHandshake(client);
25305  if(retval == UA_STATUSCODE_GOOD)
25306  retval = SessionHandshake(client);
25307  if(retval == UA_STATUSCODE_GOOD)
25308  retval = ActivateSession(client);
25309  if(retval == UA_STATUSCODE_GOOD) {
25311  client->state = UA_CLIENTSTATE_CONNECTED;
25312  } else {
25313  goto cleanup;
25314  }
25315  return retval;
25316 
25317  cleanup:
25318  UA_Client_reset(client);
25319  return retval;
25320 }
25321 
25323  if(client->state == UA_CLIENTSTATE_READY)
25326  /* Is a session established? */
25327  if(client->connection.state == UA_CONNECTION_ESTABLISHED &&
25328  !UA_NodeId_equal(&client->authenticationToken, &UA_NODEID_NULL))
25329  retval = CloseSession(client);
25330  /* Is a secure channel established? */
25332  retval |= CloseSecureChannel(client);
25333  return retval;
25334 }
25335 
25337  UA_StatusCode retval = SecureChannelHandshake(client, true);
25338  if(retval == UA_STATUSCODE_GOOD)
25339  client->state = UA_CLIENTSTATE_CONNECTED;
25340  return retval;
25341 }
25342 
25343 /****************/
25344 /* Raw Services */
25345 /****************/
25346 
25351  void *response;
25353 };
25354 
25355 static void
25356 processServiceResponse(struct ResponseDescription *rd, UA_SecureChannel *channel,
25357  UA_MessageType messageType, UA_UInt32 requestId,
25358  UA_ByteString *message) {
25360  const UA_NodeId expectedNodeId =
25361  UA_NODEID_NUMERIC(0, rd->responseType->binaryEncodingId);
25362  const UA_NodeId serviceFaultNodeId =
25363  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_SERVICEFAULT].binaryEncodingId);
25364 
25365  UA_ResponseHeader *respHeader = (UA_ResponseHeader*)rd->response;
25366  rd->processed = true;
25367 
25368  if(messageType == UA_MESSAGETYPE_ERR) {
25369  UA_TcpErrorMessage *msg = (UA_TcpErrorMessage*)message;
25370  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25371  "Server replied with an error message: %s %.*s",
25372  UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
25373  retval = msg->error;
25374  goto finish;
25375  } else if(messageType != UA_MESSAGETYPE_MSG) {
25376  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25377  "Server replied with the wrong message type");
25379  goto finish;
25380  }
25381 
25382  /* Check that the request id matches */
25383  /* Todo: we need to demux async responses since a publish responses may come
25384  at any time */
25385  if(requestId != rd->requestId) {
25386  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25387  "Reply answers the wrong requestId. "
25388  "Async services are not yet implemented.");
25390  goto finish;
25391  }
25392 
25393  /* Check that the response type matches */
25394  size_t offset = 0;
25395  UA_NodeId responseId;
25396  retval = UA_NodeId_decodeBinary(message, &offset, &responseId);
25397  if(retval != UA_STATUSCODE_GOOD)
25398  goto finish;
25399  if(!UA_NodeId_equal(&responseId, &expectedNodeId)) {
25400  if(UA_NodeId_equal(&responseId, &serviceFaultNodeId)) {
25401  /* Take the statuscode from the servicefault */
25402  retval = UA_decodeBinary(message, &offset, rd->response,
25404  } else {
25405  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25406  "Reply answers the wrong request. Expected ns=%i,i=%i."
25407  "But retrieved ns=%i,i=%i", expectedNodeId.namespaceIndex,
25408  expectedNodeId.identifier.numeric, responseId.namespaceIndex,
25409  responseId.identifier.numeric);
25410  UA_NodeId_deleteMembers(&responseId);
25412  }
25413  goto finish;
25414  }
25415 
25416  /* Decode the response */
25417  retval = UA_decodeBinary(message, &offset, rd->response, rd->responseType);
25418 
25419  finish:
25420  if(retval == UA_STATUSCODE_GOOD) {
25421  UA_LOG_DEBUG(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25422  "Received a response of type %i", responseId.identifier.numeric);
25423  } else {
25426  UA_LOG_INFO(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25427  "Error receiving the response");
25428  respHeader->serviceResult = retval;
25429  }
25430 }
25431 
25432 void
25433 __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType,
25434  void *response, const UA_DataType *responseType) {
25435  UA_init(response, responseType);
25436  UA_ResponseHeader *respHeader = (UA_ResponseHeader*)response;
25437 
25438  /* Make sure we have a valid session */
25440  if(retval != UA_STATUSCODE_GOOD) {
25441  respHeader->serviceResult = retval;
25442  client->state = UA_CLIENTSTATE_ERRORED;
25443  return;
25444  }
25445 
25446  /* Adjusting the request header. The const attribute is violated, but we
25447  * only touch the following members: */
25448  UA_RequestHeader *rr = (UA_RequestHeader*)(uintptr_t)request;
25449  rr->authenticationToken = client->authenticationToken; /* cleaned up at the end */
25450  rr->timestamp = UA_DateTime_now();
25451  rr->requestHandle = ++client->requestHandle;
25452 
25453  /* Send the request */
25454  UA_UInt32 requestId = ++client->requestId;
25455  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
25456  "Sending a request of type %i", requestType->typeId.identifier.numeric);
25457  retval = UA_SecureChannel_sendBinaryMessage(&client->channel, requestId, rr, requestType);
25458  if(retval != UA_STATUSCODE_GOOD) {
25461  else
25462  respHeader->serviceResult = retval;
25463  client->state = UA_CLIENTSTATE_FAULTED;
25464  UA_NodeId_init(&rr->authenticationToken);
25465  return;
25466  }
25467 
25468  /* Prepare the response and the structure we give into processServiceResponse */
25469  UA_init(response, responseType);
25470  struct ResponseDescription rd = {client, false, requestId, response, responseType};
25471 
25472  /* Retrieve the response */
25473  UA_DateTime maxDate = UA_DateTime_nowMonotonic() + (client->config.timeout * UA_MSEC_TO_DATETIME);
25474  do {
25475  /* Retrieve complete chunks */
25477  UA_Boolean realloced = false;
25479  if(now < maxDate) {
25480  UA_UInt32 timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
25481  retval = UA_Connection_receiveChunksBlocking(&client->connection, &reply, &realloced, timeout);
25482  } else {
25484  }
25485  if(retval != UA_STATUSCODE_GOOD) {
25486  respHeader->serviceResult = retval;
25487  break;
25488  }
25489  /* ProcessChunks and call processServiceResponse for complete messages */
25490  UA_SecureChannel_processChunks(&client->channel, &reply,
25491  (UA_ProcessMessageCallback*)processServiceResponse, &rd);
25492  /* Free the received buffer */
25493  if(!realloced)
25494  client->connection.releaseRecvBuffer(&client->connection, &reply);
25495  else
25496  UA_ByteString_deleteMembers(&reply);
25497  } while(!rd.processed);
25498 
25499  /* Clean up the authentication token */
25500  UA_NodeId_init(&rr->authenticationToken);
25501 }
25502 
25503 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_highlevel.c" ***********************************/
25504 
25505 /* This Source Code Form is subject to the terms of the Mozilla Public
25506 * License, v. 2.0. If a copy of the MPL was not distributed with this
25507 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
25508 
25509 
25512  UA_UInt16 *namespaceIndex) {
25513  UA_ReadRequest request;
25514  UA_ReadRequest_init(&request);
25515  UA_ReadValueId id;
25516  UA_ReadValueId_init(&id);
25517  id.attributeId = UA_ATTRIBUTEID_VALUE;
25518  id.nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_NAMESPACEARRAY);
25519  request.nodesToRead = &id;
25520  request.nodesToReadSize = 1;
25521 
25522  UA_ReadResponse response = UA_Client_Service_read(client, request);
25523 
25526  retval = response.responseHeader.serviceResult;
25527  else if(response.resultsSize != 1 || !response.results[0].hasValue)
25529  else if(response.results[0].value.type != &UA_TYPES[UA_TYPES_STRING])
25531 
25532  if(retval != UA_STATUSCODE_GOOD) {
25533  UA_ReadResponse_deleteMembers(&response);
25534  return retval;
25535  }
25536 
25537  retval = UA_STATUSCODE_BADNOTFOUND;
25538  UA_String *ns = response.results[0].value.data;
25539  for(size_t i = 0; i < response.results[0].value.arrayLength; ++i){
25540  if(UA_String_equal(namespaceUri, &ns[i])) {
25541  *namespaceIndex = (UA_UInt16)i;
25542  retval = UA_STATUSCODE_GOOD;
25543  break;
25544  }
25545  }
25546 
25547  UA_ReadResponse_deleteMembers(&response);
25548  return retval;
25549 }
25550 
25553  UA_NodeIteratorCallback callback, void *handle) {
25554  UA_BrowseRequest bReq;
25555  UA_BrowseRequest_init(&bReq);
25557  bReq.nodesToBrowse = UA_BrowseDescription_new();
25558  bReq.nodesToBrowseSize = 1;
25559  UA_NodeId_copy(&parentNodeId, &bReq.nodesToBrowse[0].nodeId);
25560  bReq.nodesToBrowse[0].resultMask = UA_BROWSERESULTMASK_ALL; //return everything
25562 
25563  UA_BrowseResponse bResp = UA_Client_Service_browse(client, bReq);
25564 
25567  for (size_t i = 0; i < bResp.resultsSize; ++i) {
25568  for (size_t j = 0; j < bResp.results[i].referencesSize; ++j) {
25569  UA_ReferenceDescription *ref = &(bResp.results[i].references[j]);
25570  retval |= callback(ref->nodeId.nodeId, !ref->isForward,
25571  ref->referenceTypeId, handle);
25572  }
25573  }
25574  }
25575  else
25576  retval = bResp.responseHeader.serviceResult;
25577 
25578 
25579  UA_BrowseRequest_deleteMembers(&bReq);
25580  UA_BrowseResponse_deleteMembers(&bResp);
25581 
25582  return retval;
25583 }
25584 
25585 /*******************/
25586 /* Node Management */
25587 /*******************/
25588 
25590 UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId,
25591  const UA_NodeId referenceTypeId, UA_Boolean isForward,
25592  const UA_String targetServerUri,
25593  const UA_ExpandedNodeId targetNodeId,
25594  UA_NodeClass targetNodeClass) {
25595  UA_AddReferencesItem item;
25596  UA_AddReferencesItem_init(&item);
25597  item.sourceNodeId = sourceNodeId;
25598  item.referenceTypeId = referenceTypeId;
25599  item.isForward = isForward;
25600  item.targetServerUri = targetServerUri;
25601  item.targetNodeId = targetNodeId;
25602  item.targetNodeClass = targetNodeClass;
25603  UA_AddReferencesRequest request;
25604  UA_AddReferencesRequest_init(&request);
25605  request.referencesToAdd = &item;
25606  request.referencesToAddSize = 1;
25607  UA_AddReferencesResponse response = UA_Client_Service_addReferences(client, request);
25608  UA_StatusCode retval = response.responseHeader.serviceResult;
25609  if(retval != UA_STATUSCODE_GOOD) {
25610  UA_AddReferencesResponse_deleteMembers(&response);
25611  return retval;
25612  }
25613  if(response.resultsSize != 1) {
25614  UA_AddReferencesResponse_deleteMembers(&response);
25616  }
25617  retval = response.results[0];
25618  UA_AddReferencesResponse_deleteMembers(&response);
25619  return retval;
25620 }
25621 
25623 UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId,
25624  const UA_NodeId referenceTypeId, UA_Boolean isForward,
25625  const UA_ExpandedNodeId targetNodeId,
25626  UA_Boolean deleteBidirectional) {
25628  UA_DeleteReferencesItem_init(&item);
25629  item.sourceNodeId = sourceNodeId;
25630  item.referenceTypeId = referenceTypeId;
25631  item.isForward = isForward;
25632  item.targetNodeId = targetNodeId;
25633  item.deleteBidirectional = deleteBidirectional;
25635  UA_DeleteReferencesRequest_init(&request);
25636  request.referencesToDelete = &item;
25637  request.referencesToDeleteSize = 1;
25638  UA_DeleteReferencesResponse response = UA_Client_Service_deleteReferences(client, request);
25639  UA_StatusCode retval = response.responseHeader.serviceResult;
25640  if(retval != UA_STATUSCODE_GOOD) {
25641  UA_DeleteReferencesResponse_deleteMembers(&response);
25642  return retval;
25643  }
25644  if(response.resultsSize != 1) {
25645  UA_DeleteReferencesResponse_deleteMembers(&response);
25647  }
25648  retval = response.results[0];
25649  UA_DeleteReferencesResponse_deleteMembers(&response);
25650  return retval;
25651 }
25652 
25655  UA_Boolean deleteTargetReferences) {
25656  UA_DeleteNodesItem item;
25657  UA_DeleteNodesItem_init(&item);
25658  item.nodeId = nodeId;
25659  item.deleteTargetReferences = deleteTargetReferences;
25660  UA_DeleteNodesRequest request;
25661  UA_DeleteNodesRequest_init(&request);
25662  request.nodesToDelete = &item;
25663  request.nodesToDeleteSize = 1;
25664  UA_DeleteNodesResponse response = UA_Client_Service_deleteNodes(client, request);
25665  UA_StatusCode retval = response.responseHeader.serviceResult;
25666  if(retval != UA_STATUSCODE_GOOD) {
25667  UA_DeleteNodesResponse_deleteMembers(&response);
25668  return retval;
25669  }
25670  if(response.resultsSize != 1) {
25671  UA_DeleteNodesResponse_deleteMembers(&response);
25673  }
25674  retval = response.results[0];
25675  UA_DeleteNodesResponse_deleteMembers(&response);
25676  return retval;
25677 }
25678 
25680 __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass,
25681  const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
25682  const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
25683  const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
25684  const UA_DataType *attributeType, UA_NodeId *outNewNodeId) {
25686  UA_AddNodesRequest request;
25687  UA_AddNodesRequest_init(&request);
25688  UA_AddNodesItem item;
25689  UA_AddNodesItem_init(&item);
25690  item.parentNodeId.nodeId = parentNodeId;
25691  item.referenceTypeId = referenceTypeId;
25692  item.requestedNewNodeId.nodeId = requestedNewNodeId;
25693  item.browseName = browseName;
25694  item.nodeClass = nodeClass;
25695  item.typeDefinition.nodeId = typeDefinition;
25697  item.nodeAttributes.content.decoded.type = attributeType;
25698  item.nodeAttributes.content.decoded.data = (void*)(uintptr_t)attr; // hack. is not written into.
25699  request.nodesToAdd = &item;
25700  request.nodesToAddSize = 1;
25701  UA_AddNodesResponse response = UA_Client_Service_addNodes(client, request);
25703  retval = response.responseHeader.serviceResult;
25704  UA_AddNodesResponse_deleteMembers(&response);
25705  return retval;
25706  }
25707  if(response.resultsSize != 1) {
25708  UA_AddNodesResponse_deleteMembers(&response);
25710  }
25711  if(outNewNodeId && response.results[0].statusCode == UA_STATUSCODE_GOOD) {
25712  *outNewNodeId = response.results[0].addedNodeId;
25713  UA_NodeId_init(&response.results[0].addedNodeId);
25714  }
25715  retval = response.results[0].statusCode;
25716  UA_AddNodesResponse_deleteMembers(&response);
25717  return retval;
25718 }
25719 
25720 /********/
25721 /* Call */
25722 /********/
25723 
25724 #ifdef UA_ENABLE_METHODCALLS
25725 
25727 UA_Client_call(UA_Client *client, const UA_NodeId objectId,
25728  const UA_NodeId methodId, size_t inputSize,
25729  const UA_Variant *input, size_t *outputSize,
25730  UA_Variant **output) {
25731  /* Set up the request */
25732  UA_CallRequest request;
25733  UA_CallRequest_init(&request);
25734  UA_CallMethodRequest item;
25735  UA_CallMethodRequest_init(&item);
25736  item.methodId = methodId;
25737  item.objectId = objectId;
25738  item.inputArguments = (void*)(uintptr_t)input; // cast const...
25739  item.inputArgumentsSize = inputSize;
25740  request.methodsToCall = &item;
25741  request.methodsToCallSize = 1;
25742 
25743  /* Call the service */
25744  UA_CallResponse response = UA_Client_Service_call(client, request);
25745  UA_StatusCode retval = response.responseHeader.serviceResult;
25746  if(retval == UA_STATUSCODE_GOOD) {
25747  if(response.resultsSize == 1)
25748  retval = response.results[0].statusCode;
25749  else
25751  }
25752  if(retval != UA_STATUSCODE_GOOD) {
25753  UA_CallResponse_deleteMembers(&response);
25754  return retval;
25755  }
25756 
25757  /* Move the output arguments */
25758  if(output != NULL && outputSize != NULL) {
25759  *output = response.results[0].outputArguments;
25760  *outputSize = response.results[0].outputArgumentsSize;
25761  response.results[0].outputArguments = NULL;
25762  response.results[0].outputArgumentsSize = 0;
25763  }
25764  UA_CallResponse_deleteMembers(&response);
25765  return retval;
25766 }
25767 
25768 #endif
25769 
25770 /********************/
25771 /* Write Attributes */
25772 /********************/
25773 
25776  UA_AttributeId attributeId, const void *in,
25777  const UA_DataType *inDataType) {
25778  if(!in)
25780 
25781  UA_WriteValue wValue;
25782  UA_WriteValue_init(&wValue);
25783  wValue.nodeId = *nodeId;
25784  wValue.attributeId = attributeId;
25785  if(attributeId == UA_ATTRIBUTEID_VALUE)
25786  wValue.value.value = *(const UA_Variant*)in;
25787  else
25788  /* hack. is never written into. */
25789  UA_Variant_setScalar(&wValue.value.value, (void*)(uintptr_t)in, inDataType);
25790  wValue.value.hasValue = true;
25791  UA_WriteRequest wReq;
25792  UA_WriteRequest_init(&wReq);
25793  wReq.nodesToWrite = &wValue;
25794  wReq.nodesToWriteSize = 1;
25795 
25796  UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
25797 
25799  if(retval == UA_STATUSCODE_GOOD) {
25800  if(wResp.resultsSize == 1)
25801  retval = wResp.results[0];
25802  else
25804  }
25805 
25806  UA_WriteResponse_deleteMembers(&wResp);
25807  return retval;
25808 }
25809 
25812  const UA_UInt32 *newArrayDimensions,
25813  size_t newArrayDimensionsSize) {
25814  if(!newArrayDimensions)
25816 
25817  UA_WriteValue wValue;
25818  UA_WriteValue_init(&wValue);
25819  wValue.nodeId = nodeId;
25821  UA_Variant_setArray(&wValue.value.value, (void*)(uintptr_t)newArrayDimensions,
25822  newArrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
25823  wValue.value.hasValue = true;
25824  UA_WriteRequest wReq;
25825  UA_WriteRequest_init(&wReq);
25826  wReq.nodesToWrite = &wValue;
25827  wReq.nodesToWriteSize = 1;
25828 
25829  UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
25830 
25832  if(retval == UA_STATUSCODE_GOOD) {
25833  if(wResp.resultsSize == 1)
25834  retval = wResp.results[0];
25835  else
25837  }
25838  UA_WriteResponse_deleteMembers(&wResp);
25839  return retval;
25840 }
25841 
25842 /*******************/
25843 /* Read Attributes */
25844 /*******************/
25845 
25848  UA_AttributeId attributeId, void *out,
25849  const UA_DataType *outDataType) {
25850  UA_ReadValueId item;
25851  UA_ReadValueId_init(&item);
25852  item.nodeId = *nodeId;
25853  item.attributeId = attributeId;
25854  UA_ReadRequest request;
25855  UA_ReadRequest_init(&request);
25856  request.nodesToRead = &item;
25857  request.nodesToReadSize = 1;
25858  UA_ReadResponse response = UA_Client_Service_read(client, request);
25859  UA_StatusCode retval = response.responseHeader.serviceResult;
25860  if(retval == UA_STATUSCODE_GOOD) {
25861  if(response.resultsSize == 1)
25862  retval = response.results[0].status;
25863  else
25865  }
25866  if(retval != UA_STATUSCODE_GOOD) {
25867  UA_ReadResponse_deleteMembers(&response);
25868  return retval;
25869  }
25870 
25871  /* Set the StatusCode */
25872  UA_DataValue *res = response.results;
25873  if(res->hasStatus)
25874  retval = res->status;
25875 
25876  /* Return early of no value is given */
25877  if(!res->hasValue) {
25878  if(retval == UA_STATUSCODE_GOOD)
25880  UA_ReadResponse_deleteMembers(&response);
25881  return retval;
25882  }
25883 
25884  /* Copy value into out */
25885  if(attributeId == UA_ATTRIBUTEID_VALUE) {
25886  memcpy(out, &res->value, sizeof(UA_Variant));
25887  UA_Variant_init(&res->value);
25888  } else if(attributeId == UA_ATTRIBUTEID_NODECLASS) {
25889  memcpy(out, (UA_NodeClass*)res->value.data, sizeof(UA_NodeClass));
25890  } else if(UA_Variant_isScalar(&res->value) &&
25891  res->value.type == outDataType) {
25892  memcpy(out, res->value.data, res->value.type->memSize);
25893  UA_free(res->value.data);
25894  res->value.data = NULL;
25895  } else {
25897  }
25898 
25899  UA_ReadResponse_deleteMembers(&response);
25900  return retval;
25901 }
25902 
25905  UA_UInt32 **outArrayDimensions,
25906  size_t *outArrayDimensionsSize) {
25907  UA_ReadValueId item;
25908  UA_ReadValueId_init(&item);
25909  item.nodeId = nodeId;
25911  UA_ReadRequest request;
25912  UA_ReadRequest_init(&request);
25913  request.nodesToRead = &item;
25914  request.nodesToReadSize = 1;
25915  UA_ReadResponse response = UA_Client_Service_read(client, request);
25916  UA_StatusCode retval = response.responseHeader.serviceResult;
25917  if(retval == UA_STATUSCODE_GOOD) {
25918  if(response.resultsSize == 1)
25919  retval = response.results[0].status;
25920  else
25922  }
25923  if(retval != UA_STATUSCODE_GOOD)
25924  goto cleanup;
25925 
25926  UA_DataValue *res = response.results;
25927  if(res->hasStatus != UA_STATUSCODE_GOOD)
25928  retval = res->hasStatus;
25929  else if(!res->hasValue || UA_Variant_isScalar(&res->value))
25931  if(retval != UA_STATUSCODE_GOOD)
25932  goto cleanup;
25933 
25934  if(UA_Variant_isScalar(&res->value) ||
25935  res->value.type != &UA_TYPES[UA_TYPES_UINT32]) {
25937  goto cleanup;
25938  }
25939 
25940  /* Move data out of the results structure instead of copying */
25941  *outArrayDimensions = res->value.data;
25942  *outArrayDimensionsSize = res->value.arrayLength;
25943  res->value.data = NULL;
25944  res->value.arrayLength = 0;
25945 
25946  cleanup:
25947  UA_ReadResponse_deleteMembers(&response);
25948  return retval;
25949 
25950 }
25951 
25952 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_highlevel_subscriptions.c" ***********************************/
25953 
25954 /* This Source Code Form is subject to the terms of the Mozilla Public
25955 * License, v. 2.0. If a copy of the MPL was not distributed with this
25956 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
25957 
25958 
25959 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
25960 
25962 UA_Client_Subscriptions_new(UA_Client *client, UA_SubscriptionSettings settings,
25963  UA_UInt32 *newSubscriptionId) {
25965  UA_CreateSubscriptionRequest_init(&request);
25966  request.requestedPublishingInterval = settings.requestedPublishingInterval;
25967  request.requestedLifetimeCount = settings.requestedLifetimeCount;
25968  request.requestedMaxKeepAliveCount = settings.requestedMaxKeepAliveCount;
25969  request.maxNotificationsPerPublish = settings.maxNotificationsPerPublish;
25970  request.publishingEnabled = settings.publishingEnabled;
25971  request.priority = settings.priority;
25972 
25973  UA_CreateSubscriptionResponse response = UA_Client_Service_createSubscription(client, request);
25974  UA_StatusCode retval = response.responseHeader.serviceResult;
25975  if(retval != UA_STATUSCODE_GOOD)
25976  goto cleanup;
25977 
25978  UA_Client_Subscription *newSub = UA_malloc(sizeof(UA_Client_Subscription));
25979  if(!newSub) {
25981  goto cleanup;
25982  }
25983 
25984  LIST_INIT(&newSub->monitoredItems);
25985  newSub->lifeTime = response.revisedLifetimeCount;
25986  newSub->keepAliveCount = response.revisedMaxKeepAliveCount;
25987  newSub->publishingInterval = response.revisedPublishingInterval;
25988  newSub->subscriptionID = response.subscriptionId;
25989  newSub->notificationsPerPublish = request.maxNotificationsPerPublish;
25990  newSub->priority = request.priority;
25991  LIST_INSERT_HEAD(&client->subscriptions, newSub, listEntry);
25992 
25993  if(newSubscriptionId)
25994  *newSubscriptionId = newSub->subscriptionID;
25995 
25996  cleanup:
25997  UA_CreateSubscriptionResponse_deleteMembers(&response);
25998  return retval;
25999 }
26000 
26001 /* remove the subscription remotely */
26003 UA_Client_Subscriptions_remove(UA_Client *client, UA_UInt32 subscriptionId) {
26004  UA_Client_Subscription *sub;
26005  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26006  if(sub->subscriptionID == subscriptionId)
26007  break;
26008  }
26009  if(!sub)
26011 
26013  UA_Client_MonitoredItem *mon, *tmpmon;
26014  LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, tmpmon) {
26015  retval =
26016  UA_Client_Subscriptions_removeMonitoredItem(client, sub->subscriptionID,
26017  mon->monitoredItemId);
26018  if(retval != UA_STATUSCODE_GOOD)
26019  return retval;
26020  }
26021 
26022  /* remove the subscription remotely */
26024  UA_DeleteSubscriptionsRequest_init(&request);
26025  request.subscriptionIdsSize = 1;
26026  request.subscriptionIds = &sub->subscriptionID;
26027  UA_DeleteSubscriptionsResponse response = UA_Client_Service_deleteSubscriptions(client, request);
26028  retval = response.responseHeader.serviceResult;
26029  if(retval == UA_STATUSCODE_GOOD && response.resultsSize > 0)
26030  retval = response.results[0];
26031  UA_DeleteSubscriptionsResponse_deleteMembers(&response);
26032 
26033  if(retval != UA_STATUSCODE_GOOD && retval != UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID) {
26034  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT,
26035  "Could not remove subscription %u with error code %s",
26036  sub->subscriptionID, UA_StatusCode_name(retval));
26037  return retval;
26038  }
26039 
26040  UA_Client_Subscriptions_forceDelete(client, sub);
26041  return UA_STATUSCODE_GOOD;
26042 }
26043 
26044 void
26045 UA_Client_Subscriptions_forceDelete(UA_Client *client,
26046  UA_Client_Subscription *sub) {
26047  UA_Client_MonitoredItem *mon, *mon_tmp;
26048  LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, mon_tmp) {
26049  UA_NodeId_deleteMembers(&mon->monitoredNodeId);
26050  LIST_REMOVE(mon, listEntry);
26051  UA_free(mon);
26052  }
26053  LIST_REMOVE(sub, listEntry);
26054  UA_free(sub);
26055 }
26056 
26058 UA_Client_Subscriptions_addMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
26059  UA_NodeId nodeId, UA_UInt32 attributeID,
26060  UA_MonitoredItemHandlingFunction hf,
26061  void *hfContext, UA_UInt32 *newMonitoredItemId) {
26062  UA_Client_Subscription *sub;
26063  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26064  if(sub->subscriptionID == subscriptionId)
26065  break;
26066  }
26067  if(!sub)
26069 
26070  /* Create the handler */
26071  UA_Client_MonitoredItem *newMon = UA_malloc(sizeof(UA_Client_MonitoredItem));
26072  if(!newMon)
26074 
26075  /* Send the request */
26077  UA_CreateMonitoredItemsRequest_init(&request);
26078  request.subscriptionId = subscriptionId;
26080  UA_MonitoredItemCreateRequest_init(&item);
26081  item.itemToMonitor.nodeId = nodeId;
26082  item.itemToMonitor.attributeId = attributeID;
26084  item.requestedParameters.clientHandle = ++(client->monitoredItemHandles);
26085  item.requestedParameters.samplingInterval = sub->publishingInterval;
26086  item.requestedParameters.discardOldest = true;
26087  item.requestedParameters.queueSize = 1;
26088  request.itemsToCreate = &item;
26089  request.itemsToCreateSize = 1;
26090  UA_CreateMonitoredItemsResponse response = UA_Client_Service_createMonitoredItems(client, request);
26091 
26092  // slight misuse of retval here to check if the addition was successfull.
26093  UA_StatusCode retval = response.responseHeader.serviceResult;
26094  if(retval == UA_STATUSCODE_GOOD) {
26095  if(response.resultsSize == 1)
26096  retval = response.results[0].statusCode;
26097  else
26099  }
26100  if(retval != UA_STATUSCODE_GOOD) {
26101  UA_free(newMon);
26102  UA_CreateMonitoredItemsResponse_deleteMembers(&response);
26103  return retval;
26104  }
26105 
26106  /* Set the handler */
26107  newMon->monitoringMode = UA_MONITORINGMODE_REPORTING;
26108  UA_NodeId_copy(&nodeId, &newMon->monitoredNodeId);
26109  newMon->attributeID = attributeID;
26110  newMon->clientHandle = client->monitoredItemHandles;
26111  newMon->samplingInterval = sub->publishingInterval;
26112  newMon->queueSize = 1;
26113  newMon->discardOldest = true;
26114  newMon->handler = hf;
26115  newMon->handlerContext = hfContext;
26116  newMon->monitoredItemId = response.results[0].monitoredItemId;
26117  LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry);
26118  *newMonitoredItemId = newMon->monitoredItemId;
26119 
26120  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26121  "Created a monitored item with client handle %u",
26122  client->monitoredItemHandles);
26123 
26124  UA_CreateMonitoredItemsResponse_deleteMembers(&response);
26125  return UA_STATUSCODE_GOOD;
26126 }
26127 
26129 UA_Client_Subscriptions_removeMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
26130  UA_UInt32 monitoredItemId) {
26131  UA_Client_Subscription *sub;
26132  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26133  if(sub->subscriptionID == subscriptionId)
26134  break;
26135  }
26136  if(!sub)
26138 
26139  UA_Client_MonitoredItem *mon;
26140  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
26141  if(mon->monitoredItemId == monitoredItemId)
26142  break;
26143  }
26144  if(!mon)
26146 
26147  /* remove the monitoreditem remotely */
26149  UA_DeleteMonitoredItemsRequest_init(&request);
26150  request.subscriptionId = sub->subscriptionID;
26151  request.monitoredItemIdsSize = 1;
26152  request.monitoredItemIds = &mon->monitoredItemId;
26153  UA_DeleteMonitoredItemsResponse response = UA_Client_Service_deleteMonitoredItems(client, request);
26154 
26155  UA_StatusCode retval = response.responseHeader.serviceResult;
26156  if(retval == UA_STATUSCODE_GOOD && response.resultsSize > 1)
26157  retval = response.results[0];
26158  UA_DeleteMonitoredItemsResponse_deleteMembers(&response);
26159  if(retval != UA_STATUSCODE_GOOD &&
26161  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT,
26162  "Could not remove monitoreditem %u with error code %s",
26163  monitoredItemId, UA_StatusCode_name(retval));
26164  return retval;
26165  }
26166 
26167  LIST_REMOVE(mon, listEntry);
26168  UA_NodeId_deleteMembers(&mon->monitoredNodeId);
26169  UA_free(mon);
26170  return UA_STATUSCODE_GOOD;
26171 }
26172 
26173 static void
26174 UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
26175  UA_PublishResponse *response) {
26177  return;
26178 
26179  /* Find the subscription */
26180  UA_Client_Subscription *sub;
26181  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26182  if(sub->subscriptionID == response->subscriptionId)
26183  break;
26184  }
26185  if(!sub)
26186  return;
26187 
26188  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26189  "Processing a publish response on subscription %u with %u notifications",
26190  sub->subscriptionID, response->notificationMessage.notificationDataSize);
26191 
26192  /* Check if the server has acknowledged any of the sent ACKs */
26193  for(size_t i = 0; i < response->resultsSize && i < request->subscriptionAcknowledgementsSize; ++i) {
26194  /* remove also acks that are unknown to the server */
26195  if(response->results[i] != UA_STATUSCODE_GOOD &&
26197  continue;
26198 
26199  /* Remove the ack from the list */
26201  UA_Client_NotificationsAckNumber *ack;
26202  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
26203  if(ack->subAck.subscriptionId == orig_ack->subscriptionId &&
26204  ack->subAck.sequenceNumber == orig_ack->sequenceNumber) {
26205  LIST_REMOVE(ack, listEntry);
26206  UA_free(ack);
26207  UA_assert(ack != LIST_FIRST(&client->pendingNotificationsAcks));
26208  break;
26209  }
26210  }
26211  }
26212 
26213  /* Process the notification messages */
26214  UA_NotificationMessage *msg = &response->notificationMessage;
26215  for(size_t k = 0; k < msg->notificationDataSize; ++k) {
26217  continue;
26218 
26219  /* Currently only dataChangeNotifications are supported */
26221  continue;
26222 
26223  UA_DataChangeNotification *dataChangeNotification = msg->notificationData[k].content.decoded.data;
26224  for(size_t j = 0; j < dataChangeNotification->monitoredItemsSize; ++j) {
26225  UA_MonitoredItemNotification *mitemNot = &dataChangeNotification->monitoredItems[j];
26226  UA_Client_MonitoredItem *mon;
26227  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
26228  if(mon->clientHandle == mitemNot->clientHandle) {
26229  mon->handler(mon->monitoredItemId, &mitemNot->value, mon->handlerContext);
26230  break;
26231  }
26232  }
26233  if(!mon)
26234  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26235  "Could not process a notification with clienthandle %u on subscription %u",
26236  mitemNot->clientHandle, sub->subscriptionID);
26237  }
26238  }
26239 
26240  /* Add to the list of pending acks */
26241  UA_Client_NotificationsAckNumber *tmpAck = UA_malloc(sizeof(UA_Client_NotificationsAckNumber));
26242  if(!tmpAck) {
26243  UA_LOG_WARNING(client->config.logger, UA_LOGCATEGORY_CLIENT,
26244  "Not enough memory to store the acknowledgement for a "
26245  "publish message on subscription %u", sub->subscriptionID);
26246  return;
26247  }
26248  tmpAck->subAck.sequenceNumber = msg->sequenceNumber;
26249  tmpAck->subAck.subscriptionId = sub->subscriptionID;
26250  LIST_INSERT_HEAD(&client->pendingNotificationsAcks, tmpAck, listEntry);
26251 }
26252 
26254 UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
26255  if (client->state == UA_CLIENTSTATE_ERRORED)
26257 
26258  UA_Boolean moreNotifications = true;
26259  while(moreNotifications) {
26260  UA_PublishRequest request;
26261  UA_PublishRequest_init(&request);
26263 
26264  UA_Client_NotificationsAckNumber *ack;
26265  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry)
26267  if(request.subscriptionAcknowledgementsSize > 0) {
26270  if(!request.subscriptionAcknowledgements)
26271  return UA_STATUSCODE_GOOD;
26272  }
26273 
26274  int i = 0;
26275  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
26276  request.subscriptionAcknowledgements[i].sequenceNumber = ack->subAck.sequenceNumber;
26277  request.subscriptionAcknowledgements[i].subscriptionId = ack->subAck.subscriptionId;
26278  ++i;
26279  }
26280 
26281  UA_PublishResponse response = UA_Client_Service_publish(client, request);
26282  UA_Client_processPublishResponse(client, &request, &response);
26283  moreNotifications = response.moreNotifications;
26284 
26285  UA_PublishResponse_deleteMembers(&response);
26286  UA_PublishRequest_deleteMembers(&request);
26287  }
26288  return UA_STATUSCODE_GOOD;
26289 }
26290 
26291 #endif /* UA_ENABLE_SUBSCRIPTIONS */
26292 
26293 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/libc_time.c" ***********************************/
26294 
26295 /*
26296  * Originally released by the musl project (http://www.musl-libc.org/) under the
26297  * MIT license. Taken from the file /src/time/__secs_to_tm.c
26298  */
26299 
26300 
26301 /* 2000-03-01 (mod 400 year, immediately after feb29 */
26302 #define LEAPOCH (946684800LL + 86400*(31+29))
26303 
26304 #define DAYS_PER_400Y (365*400 + 97)
26305 #define DAYS_PER_100Y (365*100 + 24)
26306 #define DAYS_PER_4Y (365*4 + 1)
26307 
26308 int __secs_to_tm(long long t, struct tm *tm)
26309 {
26310  long long days, secs, years;
26311  int remdays, remsecs, remyears;
26312  int qc_cycles, c_cycles, q_cycles;
26313  int months;
26314  int wday, yday, leap;
26315  static const char days_in_month[] = {31,30,31,30,31,31,30,31,30,31,31,29};
26316 
26317  /* Reject time_t values whose year would overflow int */
26318  if (t < INT_MIN * 31622400LL || t > INT_MAX * 31622400LL)
26319  return -1;
26320 
26321  secs = t - LEAPOCH;
26322  days = secs / 86400LL;
26323  remsecs = (int)(secs % 86400);
26324  if (remsecs < 0) {
26325  remsecs += 86400;
26326  --days;
26327  }
26328 
26329  wday = (int)((3+days)%7);
26330  if (wday < 0) wday += 7;
26331 
26332  qc_cycles = (int)(days / DAYS_PER_400Y);
26333  remdays = (int)(days % DAYS_PER_400Y);
26334  if (remdays < 0) {
26335  remdays += DAYS_PER_400Y;
26336  --qc_cycles;
26337  }
26338 
26339  c_cycles = remdays / DAYS_PER_100Y;
26340  if (c_cycles == 4) --c_cycles;
26341  remdays -= c_cycles * DAYS_PER_100Y;
26342 
26343  q_cycles = remdays / DAYS_PER_4Y;
26344  if (q_cycles == 25) --q_cycles;
26345  remdays -= q_cycles * DAYS_PER_4Y;
26346 
26347  remyears = remdays / 365;
26348  if (remyears == 4) --remyears;
26349  remdays -= remyears * 365;
26350 
26351  leap = !remyears && (q_cycles || !c_cycles);
26352  yday = remdays + 31 + 28 + leap;
26353  if (yday >= 365+leap) yday -= 365+leap;
26354 
26355  years = remyears + 4*q_cycles + 100*c_cycles + 400LL*qc_cycles;
26356 
26357  for (months=0; days_in_month[months] <= remdays; ++months)
26358  remdays -= days_in_month[months];
26359 
26360  if (years+100 > INT_MAX || years+100 < INT_MIN)
26361  return -1;
26362 
26363  tm->tm_year = (int)(years + 100);
26364  tm->tm_mon = months + 2;
26365  if (tm->tm_mon >= 12) {
26366  tm->tm_mon -=12;
26367  ++tm->tm_year;
26368  }
26369  tm->tm_mday = remdays + 1;
26370  tm->tm_wday = wday;
26371  tm->tm_yday = yday;
26372 
26373  tm->tm_hour = remsecs / 3600;
26374  tm->tm_min = remsecs / 60 % 60;
26375  tm->tm_sec = remsecs % 60;
26376 
26377  return 0;
26378 }
26379 
26380 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/pcg_basic.c" ***********************************/
26381 
26382 /*
26383  * PCG Random Number Generation for C.
26384  *
26385  * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
26386  *
26387  * Licensed under the Apache License, Version 2.0 (the "License");
26388  * you may not use this file except in compliance with the License.
26389  * You may obtain a copy of the License at
26390  *
26391  * http://www.apache.org/licenses/LICENSE-2.0
26392  *
26393  * Unless required by applicable law or agreed to in writing, software
26394  * distributed under the License is distributed on an "AS IS" BASIS,
26395  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26396  * See the License for the specific language governing permissions and
26397  * limitations under the License.
26398  *
26399  * For additional information about the PCG random number generation scheme,
26400  * including its license and other licensing options, visit
26401  *
26402  * http://www.pcg-random.org
26403  */
26404 
26405 
26406 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq) {
26407  rng->state = 0U;
26408  rng->inc = (initseq << 1u) | 1u;
26409  pcg32_random_r(rng);
26410  rng->state += initial_state;
26411  pcg32_random_r(rng);
26412 }
26413 
26415  uint64_t oldstate = rng->state;
26416  rng->state = oldstate * 6364136223846793005ULL + rng->inc;
26417  uint32_t xorshifted = (uint32_t)(((oldstate >> 18u) ^ oldstate) >> 27u);
26418  uint32_t rot = (uint32_t)(oldstate >> 59u);
26419  return (xorshifted >> rot) | (xorshifted << ((~rot + 1u) & 31)); /* was (xorshifted >> rot) | (xorshifted << ((-rot) & 31)) */
26420 }
26421 
26422 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_statuscode_descriptions.c" ***********************************/
26423 
26424 /**********************************************************
26425  * Autogenerated -- do not modify
26426  * Generated from /home/iosb/sw/open62541/tools/schema/Opc.Ua.StatusCodes.csv with script /home/iosb/sw/open62541/tools/generate_statuscode_descriptions.py
26427  *********************************************************/
26428 
26429 
26430 #ifndef UA_ENABLE_STATUSCODE_DESCRIPTIONS
26431 static const size_t statusCodeDescriptionsSize = 1;
26432 static const UA_StatusCodeDescription statusCodeDescriptions[1] = {
26433  {0xffffffff, "StatusCode descriptions not available", "open62541 was compiled without support for statuscode descriptions"}
26434 };
26435 #else
26436 static const size_t statusCodeDescriptionsSize = 229;
26437 static const UA_StatusCodeDescription statusCodeDescriptions[229] =
26438 {
26439  {UA_STATUSCODE_GOOD, "Good", "Success / No error"},
26440  {UA_STATUSCODE_BADUNEXPECTEDERROR, "BadUnexpectedError", "An unexpected error occurred."},
26441  {UA_STATUSCODE_BADINTERNALERROR, "BadInternalError", "An internal error occurred as a result of a programming or configuration error."},
26442  {UA_STATUSCODE_BADOUTOFMEMORY, "BadOutOfMemory", "Not enough memory to complete the operation."},
26443  {UA_STATUSCODE_BADRESOURCEUNAVAILABLE, "BadResourceUnavailable", "An operating system resource is not available."},
26444  {UA_STATUSCODE_BADCOMMUNICATIONERROR, "BadCommunicationError", "A low level communication error occurred."},
26445  {UA_STATUSCODE_BADENCODINGERROR, "BadEncodingError", "Encoding halted because of invalid data in the objects being serialized."},
26446  {UA_STATUSCODE_BADDECODINGERROR, "BadDecodingError", "Decoding halted because of invalid data in the stream."},
26447  {UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, "BadEncodingLimitsExceeded", "The message encoding/decoding limits imposed by the stack have been exceeded."},
26448  {UA_STATUSCODE_BADREQUESTTOOLARGE, "BadRequestTooLarge", "The request message size exceeds limits set by the server."},
26449  {UA_STATUSCODE_BADRESPONSETOOLARGE, "BadResponseTooLarge", "The response message size exceeds limits set by the client."},
26450  {UA_STATUSCODE_BADUNKNOWNRESPONSE, "BadUnknownResponse", "An unrecognized response was received from the server."},
26451  {UA_STATUSCODE_BADTIMEOUT, "BadTimeout", "The operation timed out."},
26452  {UA_STATUSCODE_BADSERVICEUNSUPPORTED, "BadServiceUnsupported", "The server does not support the requested service."},
26453  {UA_STATUSCODE_BADSHUTDOWN, "BadShutdown", "The operation was cancelled because the application is shutting down."},
26454  {UA_STATUSCODE_BADSERVERNOTCONNECTED, "BadServerNotConnected", "The operation could not complete because the client is not connected to the server."},
26455  {UA_STATUSCODE_BADSERVERHALTED, "BadServerHalted", "The server has stopped and cannot process any requests."},
26456  {UA_STATUSCODE_BADNOTHINGTODO, "BadNothingToDo", "There was nothing to do because the client passed a list of operations with no elements."},
26457  {UA_STATUSCODE_BADTOOMANYOPERATIONS, "BadTooManyOperations", "The request could not be processed because it specified too many operations."},
26458  {UA_STATUSCODE_BADTOOMANYMONITOREDITEMS, "BadTooManyMonitoredItems", "The request could not be processed because there are too many monitored items in the subscription."},
26459  {UA_STATUSCODE_BADDATATYPEIDUNKNOWN, "BadDataTypeIdUnknown", "The extension object cannot be (de)serialized because the data type id is not recognized."},
26460  {UA_STATUSCODE_BADCERTIFICATEINVALID, "BadCertificateInvalid", "The certificate provided as a parameter is not valid."},
26461  {UA_STATUSCODE_BADSECURITYCHECKSFAILED, "BadSecurityChecksFailed", "An error occurred verifying security."},
26462  {UA_STATUSCODE_BADCERTIFICATETIMEINVALID, "BadCertificateTimeInvalid", "The Certificate has expired or is not yet valid."},
26463  {UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID, "BadCertificateIssuerTimeInvalid", "An Issuer Certificate has expired or is not yet valid."},
26464  {UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID, "BadCertificateHostNameInvalid", "The HostName used to connect to a Server does not match a HostName in the Certificate."},
26465  {UA_STATUSCODE_BADCERTIFICATEURIINVALID, "BadCertificateUriInvalid", "The URI specified in the ApplicationDescription does not match the URI in the Certificate."},
26466  {UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED, "BadCertificateUseNotAllowed", "The Certificate may not be used for the requested operation."},
26467  {UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED, "BadCertificateIssuerUseNotAllowed", "The Issuer Certificate may not be used for the requested operation."},
26468  {UA_STATUSCODE_BADCERTIFICATEUNTRUSTED, "BadCertificateUntrusted", "The Certificate is not trusted."},
26469  {UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN, "BadCertificateRevocationUnknown", "It was not possible to determine if the Certificate has been revoked."},
26470  {UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN, "BadCertificateIssuerRevocationUnknown", "It was not possible to determine if the Issuer Certificate has been revoked."},
26471  {UA_STATUSCODE_BADCERTIFICATEREVOKED, "BadCertificateRevoked", "The certificate has been revoked."},
26472  {UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED, "BadCertificateIssuerRevoked", "The issuer certificate has been revoked."},
26473  {UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE, "BadCertificateChainIncomplete", "The certificate chain is incomplete."},
26474  {UA_STATUSCODE_BADUSERACCESSDENIED, "BadUserAccessDenied", "User does not have permission to perform the requested operation."},
26475  {UA_STATUSCODE_BADIDENTITYTOKENINVALID, "BadIdentityTokenInvalid", "The user identity token is not valid."},
26476  {UA_STATUSCODE_BADIDENTITYTOKENREJECTED, "BadIdentityTokenRejected", "The user identity token is valid but the server has rejected it."},
26477  {UA_STATUSCODE_BADSECURECHANNELIDINVALID, "BadSecureChannelIdInvalid", "The specified secure channel is no longer valid."},
26478  {UA_STATUSCODE_BADINVALIDTIMESTAMP, "BadInvalidTimestamp", "The timestamp is outside the range allowed by the server."},
26479  {UA_STATUSCODE_BADNONCEINVALID, "BadNonceInvalid", "The nonce does appear to be not a random value or it is not the correct length."},
26480  {UA_STATUSCODE_BADSESSIONIDINVALID, "BadSessionIdInvalid", "The session id is not valid."},
26481  {UA_STATUSCODE_BADSESSIONCLOSED, "BadSessionClosed", "The session was closed by the client."},
26482  {UA_STATUSCODE_BADSESSIONNOTACTIVATED, "BadSessionNotActivated", "The session cannot be used because ActivateSession has not been called."},
26483  {UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID, "BadSubscriptionIdInvalid", "The subscription id is not valid."},
26484  {UA_STATUSCODE_BADREQUESTHEADERINVALID, "BadRequestHeaderInvalid", "The header for the request is missing or invalid."},
26485  {UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID, "BadTimestampsToReturnInvalid", "The timestamps to return parameter is invalid."},
26486  {UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT, "BadRequestCancelledByClient", "The request was cancelled by the client."},
26487  {UA_STATUSCODE_BADTOOMANYARGUMENTS, "BadTooManyArguments", "Too many arguments were provided."},
26488  {UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED, "GoodSubscriptionTransferred", "The subscription was transferred to another session."},
26489  {UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY, "GoodCompletesAsynchronously", "The processing will complete asynchronously."},
26490  {UA_STATUSCODE_GOODOVERLOAD, "GoodOverload", "Sampling has slowed down due to resource limitations."},
26491  {UA_STATUSCODE_GOODCLAMPED, "GoodClamped", "The value written was accepted but was clamped."},
26492  {UA_STATUSCODE_BADNOCOMMUNICATION, "BadNoCommunication", "Communication with the data source is defined"},
26493  {UA_STATUSCODE_BADWAITINGFORINITIALDATA, "BadWaitingForInitialData", "Waiting for the server to obtain values from the underlying data source."},
26494  {UA_STATUSCODE_BADNODEIDINVALID, "BadNodeIdInvalid", "The syntax of the node id is not valid."},
26495  {UA_STATUSCODE_BADNODEIDUNKNOWN, "BadNodeIdUnknown", "The node id refers to a node that does not exist in the server address space."},
26496  {UA_STATUSCODE_BADATTRIBUTEIDINVALID, "BadAttributeIdInvalid", "The attribute is not supported for the specified Node."},
26497  {UA_STATUSCODE_BADINDEXRANGEINVALID, "BadIndexRangeInvalid", "The syntax of the index range parameter is invalid."},
26498  {UA_STATUSCODE_BADINDEXRANGENODATA, "BadIndexRangeNoData", "No data exists within the range of indexes specified."},
26499  {UA_STATUSCODE_BADDATAENCODINGINVALID, "BadDataEncodingInvalid", "The data encoding is invalid."},
26500  {UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED, "BadDataEncodingUnsupported", "The server does not support the requested data encoding for the node."},
26501  {UA_STATUSCODE_BADNOTREADABLE, "BadNotReadable", "The access level does not allow reading or subscribing to the Node."},
26502  {UA_STATUSCODE_BADNOTWRITABLE, "BadNotWritable", "The access level does not allow writing to the Node."},
26503  {UA_STATUSCODE_BADOUTOFRANGE, "BadOutOfRange", "The value was out of range."},
26504  {UA_STATUSCODE_BADNOTSUPPORTED, "BadNotSupported", "The requested operation is not supported."},
26505  {UA_STATUSCODE_BADNOTFOUND, "BadNotFound", "A requested item was not found or a search operation ended without success."},
26506  {UA_STATUSCODE_BADOBJECTDELETED, "BadObjectDeleted", "The object cannot be used because it has been deleted."},
26507  {UA_STATUSCODE_BADNOTIMPLEMENTED, "BadNotImplemented", "Requested operation is not implemented."},
26508  {UA_STATUSCODE_BADMONITORINGMODEINVALID, "BadMonitoringModeInvalid", "The monitoring mode is invalid."},
26509  {UA_STATUSCODE_BADMONITOREDITEMIDINVALID, "BadMonitoredItemIdInvalid", "The monitoring item id does not refer to a valid monitored item."},
26510  {UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID, "BadMonitoredItemFilterInvalid", "The monitored item filter parameter is not valid."},
26511  {UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED, "BadMonitoredItemFilterUnsupported", "The server does not support the requested monitored item filter."},
26512  {UA_STATUSCODE_BADFILTERNOTALLOWED, "BadFilterNotAllowed", "A monitoring filter cannot be used in combination with the attribute specified."},
26513  {UA_STATUSCODE_BADSTRUCTUREMISSING, "BadStructureMissing", "A mandatory structured parameter was missing or null."},
26514  {UA_STATUSCODE_BADEVENTFILTERINVALID, "BadEventFilterInvalid", "The event filter is not valid."},
26515  {UA_STATUSCODE_BADCONTENTFILTERINVALID, "BadContentFilterInvalid", "The content filter is not valid."},
26516  {UA_STATUSCODE_BADFILTEROPERATORINVALID, "BadFilterOperatorInvalid", "An unregognized operator was provided in a filter."},
26517  {UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED, "BadFilterOperatorUnsupported", "A valid operator was provided"},
26518  {UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH, "BadFilterOperandCountMismatch", "The number of operands provided for the filter operator was less then expected for the operand provided."},
26519  {UA_STATUSCODE_BADFILTEROPERANDINVALID, "BadFilterOperandInvalid", "The operand used in a content filter is not valid."},
26520  {UA_STATUSCODE_BADFILTERELEMENTINVALID, "BadFilterElementInvalid", "The referenced element is not a valid element in the content filter."},
26521  {UA_STATUSCODE_BADFILTERLITERALINVALID, "BadFilterLiteralInvalid", "The referenced literal is not a valid value."},
26522  {UA_STATUSCODE_BADCONTINUATIONPOINTINVALID, "BadContinuationPointInvalid", "The continuation point provide is longer valid."},
26523  {UA_STATUSCODE_BADNOCONTINUATIONPOINTS, "BadNoContinuationPoints", "The operation could not be processed because all continuation points have been allocated."},
26524  {UA_STATUSCODE_BADREFERENCETYPEIDINVALID, "BadReferenceTypeIdInvalid", "The operation could not be processed because all continuation points have been allocated."},
26525  {UA_STATUSCODE_BADBROWSEDIRECTIONINVALID, "BadBrowseDirectionInvalid", "The browse direction is not valid."},
26526  {UA_STATUSCODE_BADNODENOTINVIEW, "BadNodeNotInView", "The node is not part of the view."},
26527  {UA_STATUSCODE_BADSERVERURIINVALID, "BadServerUriInvalid", "The ServerUri is not a valid URI."},
26528  {UA_STATUSCODE_BADSERVERNAMEMISSING, "BadServerNameMissing", "No ServerName was specified."},
26529  {UA_STATUSCODE_BADDISCOVERYURLMISSING, "BadDiscoveryUrlMissing", "No DiscoveryUrl was specified."},
26530  {UA_STATUSCODE_BADSEMPAHOREFILEMISSING, "BadSempahoreFileMissing", "The semaphore file specified by the client is not valid."},
26531  {UA_STATUSCODE_BADREQUESTTYPEINVALID, "BadRequestTypeInvalid", "The security token request type is not valid."},
26532  {UA_STATUSCODE_BADSECURITYMODEREJECTED, "BadSecurityModeRejected", "The security mode does not meet the requirements set by the Server."},
26533  {UA_STATUSCODE_BADSECURITYPOLICYREJECTED, "BadSecurityPolicyRejected", "The security policy does not meet the requirements set by the Server."},
26534  {UA_STATUSCODE_BADTOOMANYSESSIONS, "BadTooManySessions", "The server has reached its maximum number of sessions."},
26535  {UA_STATUSCODE_BADUSERSIGNATUREINVALID, "BadUserSignatureInvalid", "The user token signature is missing or invalid."},
26536  {UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID, "BadApplicationSignatureInvalid", "The signature generated with the client certificate is missing or invalid."},
26537  {UA_STATUSCODE_BADNOVALIDCERTIFICATES, "BadNoValidCertificates", "The client did not provide at least one software certificate that is valid and meets the profile requirements for the server."},
26538  {UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED, "BadIdentityChangeNotSupported", "The Server does not support changing the user identity assigned to the session."},
26539  {UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST, "BadRequestCancelledByRequest", "The request was cancelled by the client with the Cancel service."},
26540  {UA_STATUSCODE_BADPARENTNODEIDINVALID, "BadParentNodeIdInvalid", "The parent node id does not to refer to a valid node."},
26541  {UA_STATUSCODE_BADREFERENCENOTALLOWED, "BadReferenceNotAllowed", "The reference could not be created because it violates constraints imposed by the data model."},
26542  {UA_STATUSCODE_BADNODEIDREJECTED, "BadNodeIdRejected", "The requested node id was reject because it was either invalid or server does not allow node ids to be specified by the client."},
26543  {UA_STATUSCODE_BADNODEIDEXISTS, "BadNodeIdExists", "The requested node id is already used by another node."},
26544  {UA_STATUSCODE_BADNODECLASSINVALID, "BadNodeClassInvalid", "The node class is not valid."},
26545  {UA_STATUSCODE_BADBROWSENAMEINVALID, "BadBrowseNameInvalid", "The browse name is invalid."},
26546  {UA_STATUSCODE_BADBROWSENAMEDUPLICATED, "BadBrowseNameDuplicated", "The browse name is not unique among nodes that share the same relationship with the parent."},
26547  {UA_STATUSCODE_BADNODEATTRIBUTESINVALID, "BadNodeAttributesInvalid", "The node attributes are not valid for the node class."},
26548  {UA_STATUSCODE_BADTYPEDEFINITIONINVALID, "BadTypeDefinitionInvalid", "The type definition node id does not reference an appropriate type node."},
26549  {UA_STATUSCODE_BADSOURCENODEIDINVALID, "BadSourceNodeIdInvalid", "The source node id does not reference a valid node."},
26550  {UA_STATUSCODE_BADTARGETNODEIDINVALID, "BadTargetNodeIdInvalid", "The target node id does not reference a valid node."},
26551  {UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED, "BadDuplicateReferenceNotAllowed", "The reference type between the nodes is already defined."},
26552  {UA_STATUSCODE_BADINVALIDSELFREFERENCE, "BadInvalidSelfReference", "The server does not allow this type of self reference on this node."},
26553  {UA_STATUSCODE_BADREFERENCELOCALONLY, "BadReferenceLocalOnly", "The reference type is not valid for a reference to a remote server."},
26554  {UA_STATUSCODE_BADNODELETERIGHTS, "BadNoDeleteRights", "The server will not allow the node to be deleted."},
26555  {UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED, "UncertainReferenceNotDeleted", "The server was not able to delete all target references."},
26556  {UA_STATUSCODE_BADSERVERINDEXINVALID, "BadServerIndexInvalid", "The server index is not valid."},
26557  {UA_STATUSCODE_BADVIEWIDUNKNOWN, "BadViewIdUnknown", "The view id does not refer to a valid view node."},
26558  {UA_STATUSCODE_BADVIEWTIMESTAMPINVALID, "BadViewTimestampInvalid", "The view timestamp is not available or not supported."},
26559  {UA_STATUSCODE_BADVIEWPARAMETERMISMATCH, "BadViewParameterMismatch", "The view parameters are not consistent with each other."},
26560  {UA_STATUSCODE_BADVIEWVERSIONINVALID, "BadViewVersionInvalid", "The view version is not available or not supported."},
26561  {UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE, "UncertainNotAllNodesAvailable", "The list of references may not be complete because the underlying system is not available."},
26562  {UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE, "GoodResultsMayBeIncomplete", "The server should have followed a reference to a node in a remote server but did not. The result set may be incomplete."},
26563  {UA_STATUSCODE_BADNOTTYPEDEFINITION, "BadNotTypeDefinition", "The provided Nodeid was not a type definition nodeid."},
26564  {UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER, "UncertainReferenceOutOfServer", "One of the references to follow in the relative path references to a node in the address space in another server."},
26565  {UA_STATUSCODE_BADTOOMANYMATCHES, "BadTooManyMatches", "The requested operation has too many matches to return."},
26566  {UA_STATUSCODE_BADQUERYTOOCOMPLEX, "BadQueryTooComplex", "The requested operation requires too many resources in the server."},
26567  {UA_STATUSCODE_BADNOMATCH, "BadNoMatch", "The requested operation has no match to return."},
26568  {UA_STATUSCODE_BADMAXAGEINVALID, "BadMaxAgeInvalid", "The max age parameter is invalid."},
26569  {UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT, "BadSecurityModeInsufficient", "The operation is not permitted over the current secure channel."},
26570  {UA_STATUSCODE_BADHISTORYOPERATIONINVALID, "BadHistoryOperationInvalid", "The history details parameter is not valid."},
26571  {UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED, "BadHistoryOperationUnsupported", "The server does not support the requested operation."},
26572  {UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT, "BadInvalidTimestampArgument", "The defined timestamp to return was invalid."},
26573  {UA_STATUSCODE_BADWRITENOTSUPPORTED, "BadWriteNotSupported", "The server not does support writing the combination of value"},
26574  {UA_STATUSCODE_BADTYPEMISMATCH, "BadTypeMismatch", "The value supplied for the attribute is not of the same type as the attribute's value."},
26575  {UA_STATUSCODE_BADMETHODINVALID, "BadMethodInvalid", "The method id does not refer to a method for the specified object."},
26576  {UA_STATUSCODE_BADARGUMENTSMISSING, "BadArgumentsMissing", "The client did not specify all of the input arguments for the method."},
26577  {UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS, "BadTooManySubscriptions", "The server has reached its maximum number of subscriptions."},
26578  {UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS, "BadTooManyPublishRequests", "The server has reached the maximum number of queued publish requests."},
26579  {UA_STATUSCODE_BADNOSUBSCRIPTION, "BadNoSubscription", "There is no subscription available for this session."},
26580  {UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN, "BadSequenceNumberUnknown", "The sequence number is unknown to the server."},
26581  {UA_STATUSCODE_BADMESSAGENOTAVAILABLE, "BadMessageNotAvailable", "The requested notification message is no longer available."},
26582  {UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE, "BadInsufficientClientProfile", "The Client of the current Session does not support one or more Profiles that are necessary for the Subscription."},
26583  {UA_STATUSCODE_BADSTATENOTACTIVE, "BadStateNotActive", "The sub-state machine is not currently active."},
26584  {UA_STATUSCODE_BADTCPSERVERTOOBUSY, "BadTcpServerTooBusy", "The server cannot process the request because it is too busy."},
26585  {UA_STATUSCODE_BADTCPMESSAGETYPEINVALID, "BadTcpMessageTypeInvalid", "The type of the message specified in the header invalid."},
26586  {UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN, "BadTcpSecureChannelUnknown", "The SecureChannelId and/or TokenId are not currently in use."},
26587  {UA_STATUSCODE_BADTCPMESSAGETOOLARGE, "BadTcpMessageTooLarge", "The size of the message specified in the header is too large."},
26588  {UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES, "BadTcpNotEnoughResources", "There are not enough resources to process the request."},
26589  {UA_STATUSCODE_BADTCPINTERNALERROR, "BadTcpInternalError", "An internal error occurred."},
26590  {UA_STATUSCODE_BADTCPENDPOINTURLINVALID, "BadTcpEndpointUrlInvalid", "The Server does not recognize the QueryString specified."},
26591  {UA_STATUSCODE_BADREQUESTINTERRUPTED, "BadRequestInterrupted", "The request could not be sent because of a network interruption."},
26592  {UA_STATUSCODE_BADREQUESTTIMEOUT, "BadRequestTimeout", "Timeout occurred while processing the request."},
26593  {UA_STATUSCODE_BADSECURECHANNELCLOSED, "BadSecureChannelClosed", "The secure channel has been closed."},
26594  {UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN, "BadSecureChannelTokenUnknown", "The token has expired or is not recognized."},
26595  {UA_STATUSCODE_BADSEQUENCENUMBERINVALID, "BadSequenceNumberInvalid", "The sequence number is not valid."},
26596  {UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED, "BadProtocolVersionUnsupported", "The applications do not have compatible protocol versions."},
26597  {UA_STATUSCODE_BADCONFIGURATIONERROR, "BadConfigurationError", "There is a problem with the configuration that affects the usefulness of the value."},
26598  {UA_STATUSCODE_BADNOTCONNECTED, "BadNotConnected", "The variable should receive its value from another variable"},
26599  {UA_STATUSCODE_BADDEVICEFAILURE, "BadDeviceFailure", "There has been a failure in the device/data source that generates the value that has affected the value."},
26600  {UA_STATUSCODE_BADSENSORFAILURE, "BadSensorFailure", "There has been a failure in the sensor from which the value is derived by the device/data source."},
26601  {UA_STATUSCODE_BADOUTOFSERVICE, "BadOutOfService", "The source of the data is not operational."},
26602  {UA_STATUSCODE_BADDEADBANDFILTERINVALID, "BadDeadbandFilterInvalid", "The deadband filter is not valid."},
26603  {UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE, "UncertainNoCommunicationLastUsableValue", "Communication to the data source has failed. The variable value is the last value that had a good quality."},
26604  {UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE, "UncertainLastUsableValue", "Whatever was updating this value has stopped doing so."},
26605  {UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE, "UncertainSubstituteValue", "The value is an operational value that was manually overwritten."},
26606  {UA_STATUSCODE_UNCERTAININITIALVALUE, "UncertainInitialValue", "The value is an initial value for a variable that normally receives its value from another variable."},
26607  {UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE, "UncertainSensorNotAccurate", "The value is at one of the sensor limits."},
26608  {UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED, "UncertainEngineeringUnitsExceeded", "The value is outside of the range of values defined for this parameter."},
26609  {UA_STATUSCODE_UNCERTAINSUBNORMAL, "UncertainSubNormal", "The value is derived from multiple sources and has less than the required number of Good sources."},
26610  {UA_STATUSCODE_GOODLOCALOVERRIDE, "GoodLocalOverride", "The value has been overridden."},
26611  {UA_STATUSCODE_BADREFRESHINPROGRESS, "BadRefreshInProgress", "This Condition refresh failed"},
26612  {UA_STATUSCODE_BADCONDITIONALREADYDISABLED, "BadConditionAlreadyDisabled", "This condition has already been disabled."},
26613  {UA_STATUSCODE_BADCONDITIONALREADYENABLED, "BadConditionAlreadyEnabled", "This condition has already been enabled."},
26614  {UA_STATUSCODE_BADCONDITIONDISABLED, "BadConditionDisabled", "Property not available"},
26615  {UA_STATUSCODE_BADEVENTIDUNKNOWN, "BadEventIdUnknown", "The specified event id is not recognized."},
26616  {UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE, "BadEventNotAcknowledgeable", "The event cannot be acknowledged."},
26617  {UA_STATUSCODE_BADDIALOGNOTACTIVE, "BadDialogNotActive", "The dialog condition is not active."},
26618  {UA_STATUSCODE_BADDIALOGRESPONSEINVALID, "BadDialogResponseInvalid", "The response is not valid for the dialog."},
26619  {UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED, "BadConditionBranchAlreadyAcked", "The condition branch has already been acknowledged."},
26620  {UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED, "BadConditionBranchAlreadyConfirmed", "The condition branch has already been confirmed."},
26621  {UA_STATUSCODE_BADCONDITIONALREADYSHELVED, "BadConditionAlreadyShelved", "The condition has already been shelved."},
26622  {UA_STATUSCODE_BADCONDITIONNOTSHELVED, "BadConditionNotShelved", "The condition is not currently shelved."},
26623  {UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE, "BadShelvingTimeOutOfRange", "The shelving time not within an acceptable range."},
26624  {UA_STATUSCODE_BADNODATA, "BadNoData", "No data exists for the requested time range or event filter."},
26625  {UA_STATUSCODE_BADBOUNDNOTFOUND, "BadBoundNotFound", "No data found to provide upper or lower bound value."},
26626  {UA_STATUSCODE_BADBOUNDNOTSUPPORTED, "BadBoundNotSupported", "The server cannot retrieve a bound for the variable."},
26627  {UA_STATUSCODE_BADDATALOST, "BadDataLost", "Data is missing due to collection started/stopped/lost."},
26628  {UA_STATUSCODE_BADDATAUNAVAILABLE, "BadDataUnavailable", "Expected data is unavailable for the requested time range due to an un-mounted volume"},
26629  {UA_STATUSCODE_BADENTRYEXISTS, "BadEntryExists", "The data or event was not successfully inserted because a matching entry exists."},
26630  {UA_STATUSCODE_BADNOENTRYEXISTS, "BadNoEntryExists", "The data or event was not successfully updated because no matching entry exists."},
26631  {UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED, "BadTimestampNotSupported", "The client requested history using a timestamp format the server does not support (i.e requested ServerTimestamp when server only supports SourceTimestamp)."},
26632  {UA_STATUSCODE_GOODENTRYINSERTED, "GoodEntryInserted", "The data or event was successfully inserted into the historical database."},
26633  {UA_STATUSCODE_GOODENTRYREPLACED, "GoodEntryReplaced", "The data or event field was successfully replaced in the historical database."},
26634  {UA_STATUSCODE_UNCERTAINDATASUBNORMAL, "UncertainDataSubNormal", "The value is derived from multiple values and has less than the required number of Good values."},
26635  {UA_STATUSCODE_GOODNODATA, "GoodNoData", "No data exists for the requested time range or event filter."},
26636  {UA_STATUSCODE_GOODMOREDATA, "GoodMoreData", "The data or event field was successfully replaced in the historical database."},
26637  {UA_STATUSCODE_BADAGGREGATELISTMISMATCH, "BadAggregateListMismatch", "The requested number of Aggregates does not match the requested number of NodeIds."},
26638  {UA_STATUSCODE_BADAGGREGATENOTSUPPORTED, "BadAggregateNotSupported", "The requested Aggregate is not support by the server."},
26639  {UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS, "BadAggregateInvalidInputs", "The aggregate value could not be derived due to invalid data inputs."},
26640  {UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED, "BadAggregateConfigurationRejected", "The aggregate configuration is not valid for specified node."},
26641  {UA_STATUSCODE_GOODDATAIGNORED, "GoodDataIgnored", "The request pecifies fields which are not valid for the EventType or cannot be saved by the historian."},
26642  {UA_STATUSCODE_BADREQUESTNOTALLOWED, "BadRequestNotAllowed", "The request was rejected by the server because it did not meet the criteria set by the server."},
26643  {UA_STATUSCODE_GOODEDITED, "GoodEdited", "The value does not come from the real source and has been edited by the server."},
26644  {UA_STATUSCODE_GOODPOSTACTIONFAILED, "GoodPostActionFailed", "There was an error in execution of these post-actions."},
26645  {UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED, "UncertainDominantValueChanged", "The related EngineeringUnit has been changed but the Variable Value is still provided based on the previous unit."},
26646  {UA_STATUSCODE_GOODDEPENDENTVALUECHANGED, "GoodDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device."},
26647  {UA_STATUSCODE_BADDOMINANTVALUECHANGED, "BadDominantValueChanged", "The related EngineeringUnit has been changed but this change has not been applied to the device. The Variable Value is still dependent on the previous unit but its status is currently Bad."},
26648  {UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED, "UncertainDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is uncertain."},
26649  {UA_STATUSCODE_BADDEPENDENTVALUECHANGED, "BadDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is Bad."},
26650  {UA_STATUSCODE_GOODCOMMUNICATIONEVENT, "GoodCommunicationEvent", "The communication layer has raised an event."},
26651  {UA_STATUSCODE_GOODSHUTDOWNEVENT, "GoodShutdownEvent", "The system is shutting down."},
26652  {UA_STATUSCODE_GOODCALLAGAIN, "GoodCallAgain", "The operation is not finished and needs to be called again."},
26653  {UA_STATUSCODE_GOODNONCRITICALTIMEOUT, "GoodNonCriticalTimeout", "A non-critical timeout occurred."},
26654  {UA_STATUSCODE_BADINVALIDARGUMENT, "BadInvalidArgument", "One or more arguments are invalid."},
26655  {UA_STATUSCODE_BADCONNECTIONREJECTED, "BadConnectionRejected", "Could not establish a network connection to remote server."},
26656  {UA_STATUSCODE_BADDISCONNECT, "BadDisconnect", "The server has disconnected from the client."},
26657  {UA_STATUSCODE_BADCONNECTIONCLOSED, "BadConnectionClosed", "The network connection has been closed."},
26658  {UA_STATUSCODE_BADINVALIDSTATE, "BadInvalidState", "The operation cannot be completed because the object is closed"},
26659  {UA_STATUSCODE_BADENDOFSTREAM, "BadEndOfStream", "Cannot move beyond end of the stream."},
26660  {UA_STATUSCODE_BADNODATAAVAILABLE, "BadNoDataAvailable", "No data is currently available for reading from a non-blocking stream."},
26661  {UA_STATUSCODE_BADWAITINGFORRESPONSE, "BadWaitingForResponse", "The asynchronous operation is waiting for a response."},
26662  {UA_STATUSCODE_BADOPERATIONABANDONED, "BadOperationAbandoned", "The asynchronous operation was abandoned by the caller."},
26663  {UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK, "BadExpectedStreamToBlock", "The stream did not return all data requested (possibly because it is a non-blocking stream)."},
26664  {UA_STATUSCODE_BADWOULDBLOCK, "BadWouldBlock", "Non blocking behaviour is required and the operation would block."},
26665  {UA_STATUSCODE_BADSYNTAXERROR, "BadSyntaxError", "A value had an invalid syntax."},
26666  {UA_STATUSCODE_BADMAXCONNECTIONSREACHED, "BadMaxConnectionsReached", "The operation could not be finished because all available connections are in use."},
26667  {0xffffffff, "Unknown", "Unknown StatusCode"},
26668 };
26669 #endif
26670 
26673  for(size_t i = 0; i < statusCodeDescriptionsSize; ++i) {
26674  if(statusCodeDescriptions[i].code == code)
26675  return &statusCodeDescriptions[i];
26676  }
26677  return &statusCodeDescriptions[statusCodeDescriptionsSize-1];
26678 }
26679 
26680 
26681 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_network_tcp.c" ***********************************/
26682 
26683 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
26684  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
26685 
26686 #if defined(__MINGW32__) && (!defined(WINVER) || WINVER < 0x501)
26687 /* Assume the target is newer than Windows XP */
26688 # undef WINVER
26689 # undef _WIN32_WINDOWS
26690 # undef _WIN32_WINNT
26691 # define WINVER 0x0501
26692 # define _WIN32_WINDOWS 0x0501
26693 # define _WIN32_WINNT 0x0501
26694 #endif
26695 
26696 
26697 #include <stdlib.h> // malloc, free
26698 #include <stdio.h> // snprintf
26699 #include <string.h> // memset
26700 #include <errno.h>
26701 #ifdef _WIN32
26702 # ifndef __clang__
26703 # include <malloc.h>
26704 # endif
26705 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
26706 # ifdef SLIST_ENTRY
26707 # undef SLIST_ENTRY
26708 # endif
26709 /* inet_ntoa is deprecated on MSVC but used for compatibility */
26710 # define _WINSOCK_DEPRECATED_NO_WARNINGS
26711 # include <winsock2.h>
26712 # include <ws2tcpip.h>
26713 # define CLOSESOCKET(S) closesocket((SOCKET)S)
26714 # define ssize_t int
26715 # define WIN32_INT (int)
26716 #else
26717 # define CLOSESOCKET(S) close(S)
26718 # define SOCKET int
26719 # define WIN32_INT
26720 # include <arpa/inet.h>
26721 # include <netinet/in.h>
26722 # include <sys/select.h>
26723 # include <sys/ioctl.h>
26724 # include <fcntl.h>
26725 # include <unistd.h> // read, write, close
26726 # include <netdb.h>
26727 # ifdef __QNX__
26728 # include <sys/socket.h>
26729 # endif
26730 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
26731 # include <sys/param.h>
26732 # if defined(BSD)
26733 # include<sys/socket.h>
26734 # endif
26735 #endif
26736 # ifndef __CYGWIN__
26737 # include <netinet/tcp.h>
26738 # endif
26739 #endif
26740 
26741 /* unsigned int for windows and workaround to a glibc bug */
26742 /* Additionally if GNU_LIBRARY is not defined, it may be using musl libc (e.g. Docker Alpine) */
26743 #if defined(_WIN32) || defined(__OpenBSD__) || \
26744  (defined(__GNU_LIBRARY__) && (__GNU_LIBRARY__ <= 6) && \
26745  (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 16) || \
26746  !defined(__GNU_LIBRARY__))
26747 # define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
26748 # define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
26749 #else
26750 # define UA_fd_set(fd, fds) FD_SET(fd, fds)
26751 # define UA_fd_isset(fd, fds) FD_ISSET(fd, fds)
26752 #endif
26753 
26754 #ifdef UA_ENABLE_MULTITHREADING
26755 # include <urcu/uatomic.h>
26756 #endif
26757 
26758 #ifdef _WIN32
26759 #define errno__ WSAGetLastError()
26760 # define INTERRUPTED WSAEINTR
26761 # define WOULDBLOCK WSAEWOULDBLOCK
26762 # define AGAIN WSAEWOULDBLOCK
26763 #else
26764 # define errno__ errno
26765 # define INTERRUPTED EINTR
26766 # define WOULDBLOCK EWOULDBLOCK
26767 # define AGAIN EAGAIN
26768 #endif
26769 
26770 /****************************/
26771 /* Generic Socket Functions */
26772 /****************************/
26773 
26774 static void
26775 socket_close(UA_Connection *connection) {
26776  connection->state = UA_CONNECTION_CLOSED;
26777  shutdown((SOCKET)connection->sockfd,2);
26778  CLOSESOCKET(connection->sockfd);
26779 }
26780 
26781 static UA_StatusCode
26782 socket_write(UA_Connection *connection, UA_ByteString *buf) {
26783  size_t nWritten = 0;
26784  int flags = 0;
26785 #ifdef MSG_NOSIGNAL
26786  flags = MSG_NOSIGNAL;
26787 #endif
26788  do {
26789  ssize_t n = 0;
26790  do {
26791  /* If the OS throws EMSGSIZE, force a smaller packet size:
26792  * size_t bytes_to_send = buf->length - nWritten > 1024 ? 1024 : buf->length - nWritten; */
26793  size_t bytes_to_send = buf->length - nWritten;
26794  n = send((SOCKET)connection->sockfd, (const char*)buf->data + nWritten,
26795  WIN32_INT bytes_to_send, flags);
26796  if(n < 0 && errno__ != INTERRUPTED && errno__ != AGAIN) {
26797  connection->close(connection);
26798  socket_close(connection);
26799  UA_ByteString_deleteMembers(buf);
26801  }
26802  } while(n < 0);
26803  nWritten += (size_t)n;
26804  } while(nWritten < buf->length);
26805  UA_ByteString_deleteMembers(buf);
26806  return UA_STATUSCODE_GOOD;
26807 }
26808 
26809 static UA_StatusCode
26810 socket_recv(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout) {
26811  response->data = malloc(connection->localConf.recvBufferSize);
26812  if(!response->data) {
26813  response->length = 0;
26814  return UA_STATUSCODE_BADOUTOFMEMORY; /* not enough memory retry */
26815  }
26816 
26817  if(timeout > 0) {
26818  /* currently, only the client uses timeouts */
26819 #ifndef _WIN32
26820  UA_UInt32 timeout_usec = timeout * 1000;
26821 # ifdef __APPLE__
26822  struct timeval tmptv = {(long int)(timeout_usec / 1000000), timeout_usec % 1000000};
26823 # else
26824  struct timeval tmptv = {(long int)(timeout_usec / 1000000), (long int)(timeout_usec % 1000000)};
26825 # endif
26826  int ret = setsockopt(connection->sockfd, SOL_SOCKET, SO_RCVTIMEO,
26827  (const char *)&tmptv, sizeof(struct timeval));
26828 #else
26829  DWORD timeout_dw = timeout;
26830  int ret = setsockopt(connection->sockfd, SOL_SOCKET, SO_RCVTIMEO,
26831  (const char*)&timeout_dw, sizeof(DWORD));
26832 #endif
26833  if(0 != ret) {
26834  UA_ByteString_deleteMembers(response);
26835  socket_close(connection);
26837  }
26838  }
26839 
26840 #ifdef __CYGWIN__
26841  /* Workaround for https://cygwin.com/ml/cygwin/2013-07/msg00107.html */
26842  ssize_t ret;
26843  if(timeout > 0) {
26844  fd_set fdset;
26845  FD_ZERO(&fdset);
26846  UA_fd_set(connection->sockfd, &fdset);
26847  UA_UInt32 timeout_usec = timeout * 1000;
26848  struct timeval tmptv = {(long int)(timeout_usec / 1000000),
26849  (long int)(timeout_usec % 1000000)};
26850  int retval = select(connection->sockfd+1, &fdset, NULL, NULL, &tmptv);
26851  if(retval && UA_fd_isset(connection->sockfd, &fdset)) {
26852  ret = recv(connection->sockfd, (char*)response->data,
26853  connection->localConf.recvBufferSize, 0);
26854  } else {
26855  ret = 0;
26856  }
26857  } else {
26858  ret = recv(connection->sockfd, (char*)response->data,
26859  connection->localConf.recvBufferSize, 0);
26860  }
26861 #else
26862  ssize_t ret = recv(connection->sockfd, (char*)response->data,
26863  connection->localConf.recvBufferSize, 0);
26864 #endif
26865 
26866  /* server has closed the connection */
26867  if(ret == 0) {
26868  UA_ByteString_deleteMembers(response);
26869  socket_close(connection);
26871  }
26872 
26873  /* error case */
26874  if(ret < 0) {
26875  UA_ByteString_deleteMembers(response);
26876  if(errno__ == INTERRUPTED || (timeout > 0) ?
26877  false : (errno__ == EAGAIN || errno__ == WOULDBLOCK))
26878  return UA_STATUSCODE_GOOD; /* statuscode_good but no data -> retry */
26879  socket_close(connection);
26881  }
26882 
26883  /* default case */
26884  response->length = (size_t)ret;
26885  return UA_STATUSCODE_GOOD;
26886 }
26887 
26888 static UA_StatusCode socket_set_nonblocking(SOCKET sockfd) {
26889 #ifdef _WIN32
26890  u_long iMode = 1;
26891  if(ioctlsocket(sockfd, FIONBIO, &iMode) != NO_ERROR)
26893 #else
26894  int opts = fcntl(sockfd, F_GETFL);
26895  if(opts < 0 || fcntl(sockfd, F_SETFL, opts|O_NONBLOCK) < 0)
26897 #endif
26898  return UA_STATUSCODE_GOOD;
26899 }
26900 
26901 static void FreeConnectionCallback(UA_Server *server, void *ptr) {
26903  free(ptr);
26904  }
26905 
26906 /***************************/
26907 /* Server NetworkLayer TCP */
26908 /***************************/
26909 
26943 #define MAXBACKLOG 100
26944 
26945 typedef struct {
26948  UA_Logger logger; // Set during start
26949 
26950  /* open sockets and connections */
26956  } *mappings;
26958 
26959 static UA_StatusCode
26960 ServerNetworkLayerGetSendBuffer(UA_Connection *connection, size_t length, UA_ByteString *buf) {
26961  if(length > connection->remoteConf.recvBufferSize)
26963  return UA_ByteString_allocBuffer(buf, length);
26964 }
26965 
26966 static void
26967 ServerNetworkLayerReleaseSendBuffer(UA_Connection *connection, UA_ByteString *buf) {
26968  UA_ByteString_deleteMembers(buf);
26969 }
26970 
26971 static void
26972 ServerNetworkLayerReleaseRecvBuffer(UA_Connection *connection, UA_ByteString *buf) {
26973  UA_ByteString_deleteMembers(buf);
26974 }
26975 
26976 /* after every select, we need to reset the sockets we want to listen on */
26977 static UA_Int32
26978 setFDSet(ServerNetworkLayerTCP *layer, fd_set *fdset) {
26979  FD_ZERO(fdset);
26980  UA_fd_set(layer->serversockfd, fdset);
26981  UA_Int32 highestfd = layer->serversockfd;
26982  for(size_t i = 0; i < layer->mappingsSize; ++i) {
26983  UA_fd_set(layer->mappings[i].sockfd, fdset);
26984  if(layer->mappings[i].sockfd > highestfd)
26985  highestfd = layer->mappings[i].sockfd;
26986  }
26987  return highestfd;
26988 }
26989 
26990 /* callback triggered from the server */
26991 static void
26992 ServerNetworkLayerTCP_closeConnection(UA_Connection *connection) {
26993 #ifdef UA_ENABLE_MULTITHREADING
26994  if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
26995  return;
26996 #else
26997  if(connection->state == UA_CONNECTION_CLOSED)
26998  return;
26999  connection->state = UA_CONNECTION_CLOSED;
27000 #endif
27001 #if UA_LOGLEVEL <= 300
27002  //cppcheck-suppress unreadVariable
27003  ServerNetworkLayerTCP *layer = connection->handle;
27004  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27005  "Connection %i | Force closing the connection",
27006  connection->sockfd);
27007 #endif
27008  /* only "shutdown" here. this triggers the select, where the socket is
27009  "closed" in the mainloop */
27010  shutdown(connection->sockfd, 2);
27011 }
27012 
27013 /* call only from the single networking thread */
27014 static UA_StatusCode
27015 ServerNetworkLayerTCP_add(ServerNetworkLayerTCP *layer, UA_Int32 newsockfd) {
27016  UA_Connection *c = malloc(sizeof(UA_Connection));
27017  if(!c)
27019 
27020  struct sockaddr_in addr;
27021  socklen_t addrlen = sizeof(struct sockaddr_in);
27022  int res = getpeername(newsockfd, (struct sockaddr*)&addr, &addrlen);
27023 
27024  if(res == 0) {
27025  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27026  "Connection %i | New connection over TCP from %s:%d",
27027  newsockfd, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
27028  } else {
27029  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27030  "Connection %i | New connection over TCP, "
27031  "getpeername failed with errno %i", newsockfd, errno);
27032  }
27033 
27034  memset(c, 0, sizeof(UA_Connection));
27035  c->sockfd = newsockfd;
27036  c->handle = layer;
27037  c->localConf = layer->conf;
27038  c->remoteConf = layer->conf;
27039  c->send = socket_write;
27040  c->close = ServerNetworkLayerTCP_closeConnection;
27041  c->getSendBuffer = ServerNetworkLayerGetSendBuffer;
27042  c->releaseSendBuffer = ServerNetworkLayerReleaseSendBuffer;
27043  c->releaseRecvBuffer = ServerNetworkLayerReleaseRecvBuffer;
27045  struct ConnectionMapping *nm;
27046  nm = realloc(layer->mappings,
27047  sizeof(struct ConnectionMapping)*(layer->mappingsSize+1));
27048  if(!nm) {
27049  UA_LOG_ERROR(layer->logger, UA_LOGCATEGORY_NETWORK,
27050  "No memory for a new Connection");
27051  free(c);
27053  }
27054  layer->mappings = nm;
27055  layer->mappings[layer->mappingsSize].connection = c;
27056  layer->mappings[layer->mappingsSize].sockfd = newsockfd;
27057  ++layer->mappingsSize;
27058  return UA_STATUSCODE_GOOD;
27059 }
27060 
27061 static UA_StatusCode
27062 ServerNetworkLayerTCP_start(UA_ServerNetworkLayer *nl, UA_Logger logger) {
27063  ServerNetworkLayerTCP *layer = nl->handle;
27064  layer->logger = logger;
27065 
27066  /* get the discovery url from the hostname */
27068  char hostname[256];
27069  if(gethostname(hostname, 255) == 0) {
27070  char discoveryUrl[256];
27071 #ifndef _MSC_VER
27072  du.length = (size_t)snprintf(discoveryUrl, 255, "opc.tcp://%s:%d",
27073  hostname, layer->port);
27074 #else
27075  du.length = (size_t)_snprintf_s(discoveryUrl, 255, _TRUNCATE,
27076  "opc.tcp://%s:%d", hostname, layer->port);
27077 #endif
27078  du.data = (UA_Byte*)discoveryUrl;
27079  }
27080  UA_String_copy(&du, &nl->discoveryUrl);
27081 
27082  /* Create the server socket */
27083  SOCKET newsock = socket(PF_INET, SOCK_STREAM, 0);
27084 #ifdef _WIN32
27085  if(newsock == INVALID_SOCKET)
27086 #else
27087  if(newsock < 0)
27088 #endif
27089  {
27090  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27091  "Error opening the server socket");
27093  }
27094 
27095  /* Set socket options */
27096  int optval = 1;
27097  if(setsockopt(newsock, SOL_SOCKET, SO_REUSEADDR,
27098  (const char *)&optval, sizeof(optval)) == -1 ||
27099  socket_set_nonblocking(newsock) != UA_STATUSCODE_GOOD) {
27100  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27101  "Error during setting of server socket options");
27102  CLOSESOCKET(newsock);
27104  }
27105 
27106  /* Bind socket to address */
27107  const struct sockaddr_in serv_addr = {
27108  .sin_family = AF_INET, .sin_addr.s_addr = INADDR_ANY,
27109  .sin_port = htons(layer->port), .sin_zero = {0}};
27110  if(bind(newsock, (const struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
27111  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27112  "Error during binding of the server socket");
27113  CLOSESOCKET(newsock);
27115  }
27116 
27117  /* Start listening */
27118  if(listen(newsock, MAXBACKLOG) < 0) {
27119  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27120  "Error listening on server socket");
27121  CLOSESOCKET(newsock);
27123  }
27124 
27125  layer->serversockfd = (UA_Int32)newsock; /* cast on win32 */
27126  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27127  "TCP network layer listening on %.*s",
27129  return UA_STATUSCODE_GOOD;
27130 }
27131 
27132 static size_t
27133 removeClosedConnections(ServerNetworkLayerTCP *layer, UA_Job *js) {
27134  size_t c = 0;
27135  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27136  if(layer->mappings[i].connection &&
27138  continue;
27139  /* the socket was closed from remote */
27140  UA_Connection *conn = layer->mappings[i].connection;
27141  js[c].type = UA_JOBTYPE_DETACHCONNECTION;
27142  js[c].job.closeConnection = conn;
27143  layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
27144  --layer->mappingsSize;
27145  ++c;
27146  js[c].type = UA_JOBTYPE_METHODCALL_DELAYED;
27147  js[c].job.methodCall.method = FreeConnectionCallback;
27148  js[c].job.methodCall.data = conn;
27149  ++c;
27150  }
27151  return c;
27152 }
27153 
27154 static size_t
27155 ServerNetworkLayerTCP_getJobs(UA_ServerNetworkLayer *nl, UA_Job **jobs,
27156  UA_UInt16 timeout) {
27157  /* Every open socket can generate two jobs */
27158  ServerNetworkLayerTCP *layer = nl->handle;
27159  UA_Job *js = malloc(sizeof(UA_Job) * (size_t)((layer->mappingsSize * 2)));
27160  if(!js)
27162 
27163  /* Remove closed sockets */
27164  size_t totalJobs = removeClosedConnections(layer, js);
27165 
27166  /* Listen on open sockets (including the server) */
27167  fd_set fdset, errset;
27168  UA_Int32 highestfd = setFDSet(layer, &fdset);
27169  setFDSet(layer, &errset);
27170  struct timeval tmptv = {0, timeout * 1000};
27171  UA_Int32 resultsize = select(highestfd+1, &fdset, NULL, &errset, &tmptv);
27172  if(totalJobs == 0 && resultsize <= 0) {
27173  free(js);
27174  *jobs = NULL;
27175  return 0;
27176  }
27177 
27178  /* Accept new connection via the server socket (can only be a single one) */
27179  if(UA_fd_isset(layer->serversockfd, &fdset)) {
27180  --resultsize;
27181  SOCKET newsockfd = accept((SOCKET)layer->serversockfd, NULL, NULL);
27182 #ifdef _WIN32
27183  if(newsockfd != INVALID_SOCKET)
27184 #else
27185  if(newsockfd >= 0)
27186 #endif
27187  {
27188  socket_set_nonblocking(newsockfd);
27189  /* Do not merge packets on the socket (disable Nagle's algorithm) */
27190  int i = 1;
27191  setsockopt(newsockfd, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
27192  ServerNetworkLayerTCP_add(layer, (UA_Int32)newsockfd);
27193  }
27194  }
27195 
27196  /* Read from established sockets */
27198  size_t j = 0;
27199  for(size_t i = 0; i < layer->mappingsSize && j < (size_t)resultsize; ++i) {
27200  if(!UA_fd_isset(layer->mappings[i].sockfd, &errset) &&
27201  !UA_fd_isset(layer->mappings[i].sockfd, &fdset))
27202  continue;
27203 
27204  UA_StatusCode retval = socket_recv(layer->mappings[i].connection, &buf, 0);
27205  if(retval == UA_STATUSCODE_GOOD) {
27206  js[totalJobs + j].job.binaryMessage.connection = layer->mappings[i].connection;
27207  js[totalJobs + j].job.binaryMessage.message = buf;
27208  js[totalJobs + j].type = UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER;
27209  ++j;
27210  } else if (retval == UA_STATUSCODE_BADCONNECTIONCLOSED) {
27211  UA_Connection *c = layer->mappings[i].connection;
27212  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27213  "Connection %i | Connection closed from remote", c->sockfd);
27214  /* the socket was closed from remote */
27215  js[totalJobs + j].type = UA_JOBTYPE_DETACHCONNECTION;
27216  js[totalJobs + j].job.closeConnection = c;
27217  layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
27218  --layer->mappingsSize;
27219  ++totalJobs; /* increase j only once */
27220  js[totalJobs + j].type = UA_JOBTYPE_METHODCALL_DELAYED;
27221  js[totalJobs + j].job.methodCall.method = FreeConnectionCallback;
27222  js[totalJobs + j].job.methodCall.data = c;
27223  ++j;
27224  }
27225  }
27226  totalJobs += j;
27227 
27228  if(totalJobs == 0) {
27229  free(js);
27230  js = NULL;
27231  }
27232  *jobs = js;
27233  return totalJobs;
27234 }
27235 
27236 static size_t
27237 ServerNetworkLayerTCP_stop(UA_ServerNetworkLayer *nl, UA_Job **jobs) {
27238  ServerNetworkLayerTCP *layer = nl->handle;
27239  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27240  "Shutting down the TCP network layer with %d open connection(s)",
27241  layer->mappingsSize);
27242  shutdown((SOCKET)layer->serversockfd,2);
27243  CLOSESOCKET(layer->serversockfd);
27244  UA_Job *items = malloc(sizeof(UA_Job) * layer->mappingsSize * 2);
27245  if(!items)
27246  return 0;
27247  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27248  socket_close(layer->mappings[i].connection);
27249  items[i*2].type = UA_JOBTYPE_DETACHCONNECTION;
27250  items[i*2].job.closeConnection = layer->mappings[i].connection;
27251  items[(i*2)+1].type = UA_JOBTYPE_METHODCALL_DELAYED;
27252  items[(i*2)+1].job.methodCall.method = FreeConnectionCallback;
27253  items[(i*2)+1].job.methodCall.data = layer->mappings[i].connection;
27254  }
27255 #ifdef _WIN32
27256  WSACleanup();
27257 #endif
27258  *jobs = items;
27259  return layer->mappingsSize*2;
27260 }
27261 
27262 /* run only when the server is stopped */
27263 static void ServerNetworkLayerTCP_deleteMembers(UA_ServerNetworkLayer *nl) {
27264  ServerNetworkLayerTCP *layer = nl->handle;
27265  free(layer->mappings);
27266  free(layer);
27267  UA_String_deleteMembers(&nl->discoveryUrl);
27268 }
27269 
27272 #ifdef _WIN32
27273  WORD wVersionRequested;
27274  WSADATA wsaData;
27275  wVersionRequested = MAKEWORD(2, 2);
27276  WSAStartup(wVersionRequested, &wsaData);
27277 #endif
27278 
27280  memset(&nl, 0, sizeof(UA_ServerNetworkLayer));
27281  ServerNetworkLayerTCP *layer = calloc(1,sizeof(ServerNetworkLayerTCP));
27282  if(!layer)
27283  return nl;
27284 
27285  layer->conf = conf;
27286  layer->port = port;
27287 
27288  nl.handle = layer;
27289  nl.start = ServerNetworkLayerTCP_start;
27290  nl.getJobs = ServerNetworkLayerTCP_getJobs;
27291  nl.stop = ServerNetworkLayerTCP_stop;
27292  nl.deleteMembers = ServerNetworkLayerTCP_deleteMembers;
27293  return nl;
27294 }
27295 
27296 /***************************/
27297 /* Client NetworkLayer TCP */
27298 /***************************/
27299 
27300 static UA_StatusCode
27301 ClientNetworkLayerGetBuffer(UA_Connection *connection, size_t length,
27302  UA_ByteString *buf) {
27303  if(length > connection->remoteConf.recvBufferSize)
27305  if(connection->state == UA_CONNECTION_CLOSED)
27307  return UA_ByteString_allocBuffer(buf, connection->remoteConf.recvBufferSize);
27308 }
27309 
27310 static void
27311 ClientNetworkLayerReleaseBuffer(UA_Connection *connection, UA_ByteString *buf) {
27312  UA_ByteString_deleteMembers(buf);
27313 }
27314 
27315 static void
27316 ClientNetworkLayerClose(UA_Connection *connection) {
27317 #ifdef UA_ENABLE_MULTITHREADING
27318  if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
27319  return;
27320 #else
27321  if(connection->state == UA_CONNECTION_CLOSED)
27322  return;
27323  connection->state = UA_CONNECTION_CLOSED;
27324 #endif
27325  socket_close(connection);
27326 }
27327 
27328 /* we have no networklayer. instead, attach the reusable buffer to the handle */
27330 UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl,
27331  UA_Logger logger) {
27332 #ifdef _WIN32
27333  WORD wVersionRequested;
27334  WSADATA wsaData;
27335  wVersionRequested = MAKEWORD(2, 2);
27336  WSAStartup(wVersionRequested, &wsaData);
27337 #endif
27338 
27339  UA_Connection connection;
27340  memset(&connection, 0, sizeof(UA_Connection));
27341  connection.state = UA_CONNECTION_OPENING;
27342  connection.localConf = conf;
27343  connection.remoteConf = conf;
27344  connection.send = socket_write;
27345  connection.recv = socket_recv;
27346  connection.close = ClientNetworkLayerClose;
27347  connection.getSendBuffer = ClientNetworkLayerGetBuffer;
27348  connection.releaseSendBuffer = ClientNetworkLayerReleaseBuffer;
27349  connection.releaseRecvBuffer = ClientNetworkLayerReleaseBuffer;
27350 
27351  char hostname[512];
27352  UA_UInt16 port = 0;
27353  const char *path = NULL;
27354 
27355  UA_StatusCode parse_retval = UA_EndpointUrl_split(endpointUrl, hostname, &port, &path);
27356  if(parse_retval != UA_STATUSCODE_GOOD) {
27357  if(parse_retval == UA_STATUSCODE_BADOUTOFRANGE)
27358  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27359  "Server url is invalid: %s", endpointUrl);
27360  else if(parse_retval == UA_STATUSCODE_BADATTRIBUTEIDINVALID)
27361  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27362  "Server url does not begin with 'opc.tcp://' '%s'",
27363  endpointUrl);
27364  return connection;
27365  }
27366 
27367  if(port == 0) {
27368  port = 4840;
27369  UA_LOG_INFO(logger, UA_LOGCATEGORY_NETWORK,
27370  "No port defined, using standard port %d", port);
27371  }
27372 
27373  struct addrinfo hints, *server;
27374  memset(&hints, 0, sizeof(hints));
27375  hints.ai_socktype = SOCK_STREAM;
27376  hints.ai_family = AF_INET;
27377  char portStr[6];
27378 #ifndef _MSC_VER
27379  snprintf(portStr, 6, "%d", port);
27380 #else
27381  _snprintf_s(portStr, 6, _TRUNCATE, "%d", port);
27382 #endif
27383  int error = getaddrinfo(hostname, portStr, &hints, &server);
27384  if(error != 0 || !server) {
27385  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27386  "DNS lookup of %s failed with error %s",
27387  hostname, gai_strerror(error));
27388  return connection;
27389  }
27390 
27391  /* Get a socket */
27392  SOCKET clientsockfd = socket(server->ai_family, server->ai_socktype,
27393  server->ai_protocol);
27394 #ifdef _WIN32
27395  if(clientsockfd == INVALID_SOCKET) {
27396 #else
27397  if(clientsockfd < 0) {
27398 #endif
27399  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27400  "Could not create client socket");
27401  freeaddrinfo(server);
27402  return connection;
27403  }
27404 
27405  /* Connect to the server */
27406  connection.sockfd = (UA_Int32)clientsockfd; /* cast for win32 */
27407  error = connect(clientsockfd, server->ai_addr, WIN32_INT server->ai_addrlen);
27408  freeaddrinfo(server);
27409  if(error < 0) {
27410  ClientNetworkLayerClose(&connection);
27411 #ifdef _WIN32
27412  wchar_t *s = NULL;
27413  FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
27414  FORMAT_MESSAGE_FROM_SYSTEM |
27415  FORMAT_MESSAGE_IGNORE_INSERTS,
27416  NULL, WSAGetLastError(),
27417  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
27418  (LPWSTR)&s, 0, NULL);
27419  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27420  "Connection to %s failed. Error: %d: %S",
27421  endpointUrl, WSAGetLastError(), s);
27422  LocalFree(s);
27423 #else
27424  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27425  "Connection to %s failed. Error: %d: %s",
27426  endpointUrl, errno, strerror(errno));
27427 #endif
27428  return connection;
27429  }
27430 
27431 #ifdef SO_NOSIGPIPE
27432  int val = 1;
27433  int sso_result = setsockopt(connection.sockfd,
27434  SOL_SOCKET, SO_NOSIGPIPE,
27435  (void*)&val, sizeof(val));
27436  if(sso_result < 0)
27437  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27438  "Couldn't set SO_NOSIGPIPE");
27439 #endif
27440 
27441  return connection;
27442 }
27443 
27444 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_clock.c" ***********************************/
27445 
27446 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27447  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27448 
27449 
27450 #include <time.h>
27451 #ifdef _WIN32
27452 # ifdef SLIST_ENTRY
27453 # undef SLIST_ENTRY /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
27454 # endif
27455 # include <windows.h>
27456 #else
27457 # include <sys/time.h>
27458 #endif
27459 
27460 #if defined(__APPLE__) || defined(__MACH__)
27461 # include <mach/clock.h>
27462 # include <mach/mach.h>
27463 #endif
27464 
27466 #if defined(_WIN32)
27467  /* Windows filetime has the same definition as UA_DateTime */
27468  FILETIME ft;
27469  SYSTEMTIME st;
27470  GetSystemTime(&st);
27471  SystemTimeToFileTime(&st, &ft);
27472  ULARGE_INTEGER ul;
27473  ul.LowPart = ft.dwLowDateTime;
27474  ul.HighPart = ft.dwHighDateTime;
27475  return (UA_DateTime)ul.QuadPart;
27476 #else
27477  struct timeval tv;
27478  gettimeofday(&tv, NULL);
27479  return (tv.tv_sec * UA_SEC_TO_DATETIME) + (tv.tv_usec * UA_USEC_TO_DATETIME) + UA_DATETIME_UNIX_EPOCH;
27480 #endif
27481 }
27482 
27484 #if defined(_WIN32)
27485  LARGE_INTEGER freq, ticks;
27486  QueryPerformanceFrequency(&freq);
27487  QueryPerformanceCounter(&ticks);
27488  UA_Double ticks2dt = UA_SEC_TO_DATETIME / (UA_Double)freq.QuadPart;
27489  return (UA_DateTime)(ticks.QuadPart * ticks2dt);
27490 #elif defined(__APPLE__) || defined(__MACH__)
27491  /* OS X does not have clock_gettime, use clock_get_time */
27492  clock_serv_t cclock;
27493  mach_timespec_t mts;
27494  host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
27495  clock_get_time(cclock, &mts);
27496  mach_port_deallocate(mach_task_self(), cclock);
27497  return (mts.tv_sec * UA_SEC_TO_DATETIME) + (mts.tv_nsec / 100);
27498 #elif !defined(CLOCK_MONOTONIC_RAW)
27499  struct timespec ts;
27500  clock_gettime(CLOCK_MONOTONIC, &ts);
27501  return (ts.tv_sec * UA_SEC_TO_DATETIME) + (ts.tv_nsec / 100);
27502 #else
27503  struct timespec ts;
27504  clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
27505  return (ts.tv_sec * UA_SEC_TO_DATETIME) + (ts.tv_nsec / 100);
27506 #endif
27507 }
27508 
27509 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_log_stdout.c" ***********************************/
27510 
27511 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27512  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27513 
27514 #include <stdio.h>
27515 #include <stdarg.h>
27516 
27517 #ifdef UA_ENABLE_MULTITHREADING
27518 #include <pthread.h>
27519 static pthread_mutex_t printf_mutex = PTHREAD_MUTEX_INITIALIZER;
27520 #endif
27521 
27522 const char *LogLevelNames[6] = {"trace", "debug", "info", "warning", "error", "fatal"};
27523 const char *LogCategoryNames[6] = {"network", "channel", "session", "server", "client", "userland"};
27524 
27525 #if (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || \
27526  defined(__clang__)
27527 # pragma GCC diagnostic push
27528 # pragma GCC diagnostic ignored "-Wformat-nonliteral"
27529 #endif
27530 
27531 void
27533  const char *msg, va_list args) {
27535 #ifdef UA_ENABLE_MULTITHREADING
27536  pthread_mutex_lock(&printf_mutex);
27537 #endif
27538  printf("[%.23s] %s/%s\t", t.data, LogLevelNames[level], LogCategoryNames[category]);
27539  vprintf(msg, args);
27540  printf("\n");
27541  fflush(stdout);
27542 #ifdef UA_ENABLE_MULTITHREADING
27543  pthread_mutex_unlock(&printf_mutex);
27544 #endif
27545  UA_ByteString_deleteMembers(&t);
27546 }
27547 
27548 #if (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || \
27549  defined(__clang__)
27550 # pragma GCC diagnostic pop
27551 #endif
27552 
27553 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_config_standard.c" ***********************************/
27554 
27555 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27556  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27557 
27558 
27559 /*******************************/
27560 /* Default Connection Settings */
27561 /*******************************/
27562 
27564  .protocolVersion = 0,
27565  .sendBufferSize = 65535, /* 64k per chunk */
27566  .recvBufferSize = 65535, /* 64k per chunk */
27567  .maxMessageSize = 0, /* 0 -> unlimited */
27568  .maxChunkCount = 0 /* 0 -> unlimited */
27569 };
27570 
27571 /***************************/
27572 /* Default Server Settings */
27573 /***************************/
27574 
27575 #define MANUFACTURER_NAME "open62541"
27576 #define PRODUCT_NAME "open62541 OPC UA Server"
27577 #define PRODUCT_URI "http://open62541.org"
27578 #define APPLICATION_NAME "open62541-based OPC UA Application"
27579 #define APPLICATION_URI "urn:unconfigured:application"
27580 
27581 #define UA_STRING_STATIC(s) {sizeof(s)-1, (UA_Byte*)s}
27582 #define UA_STRING_STATIC_NULL {0, NULL}
27583 
27584 #define STRINGIFY(arg) #arg
27585 #define VERSION(MAJOR, MINOR, PATCH, LABEL) \
27586  STRINGIFY(MAJOR) "." STRINGIFY(MINOR) "." STRINGIFY(PATCH) LABEL
27587 
27589  { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") },
27590  { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } };
27591 
27593  .nThreads = 1,
27594  .logger = UA_Log_Stdout,
27595 
27596  /* Server Description */
27597  .buildInfo = {
27598  .productUri = UA_STRING_STATIC(PRODUCT_URI),
27599  .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME),
27600  .productName = UA_STRING_STATIC(PRODUCT_NAME),
27601  .softwareVersion = UA_STRING_STATIC(VERSION(UA_OPEN62541_VER_MAJOR,
27605  .buildNumber = UA_STRING_STATIC(__DATE__ " " __TIME__),
27606  .buildDate = 0 },
27607  .applicationDescription = {
27608  .applicationUri = UA_STRING_STATIC(APPLICATION_URI),
27609  .productUri = UA_STRING_STATIC(PRODUCT_URI),
27610  .applicationName = { .locale = UA_STRING_STATIC("en"),
27612  .applicationType = UA_APPLICATIONTYPE_SERVER,
27613  .gatewayServerUri = UA_STRING_STATIC_NULL,
27614  .discoveryProfileUri = UA_STRING_STATIC_NULL,
27615  .discoveryUrlsSize = 0,
27616  .discoveryUrls = NULL },
27617  .serverCertificate = UA_STRING_STATIC_NULL,
27618 
27619  /* Networking */
27620  .networkLayersSize = 0,
27621  .networkLayers = NULL,
27622 
27623  /* Login */
27624  .enableAnonymousLogin = true,
27625  .enableUsernamePasswordLogin = true,
27626  .usernamePasswordLogins = usernamePasswords,
27627  .usernamePasswordLoginsSize = 2,
27628 
27629  /* Limits for SecureChannels */
27630  .maxSecureChannels = 40,
27631  .maxSecurityTokenLifetime = 10 * 60 * 1000, /* 10 minutes */
27632 
27633  /* Limits for Sessions */
27634  .maxSessions = 100,
27635  .maxSessionTimeout = 60.0 * 60.0 * 1000.0, /* 1h */
27636 
27637  /* Limits for Subscriptions */
27638  .publishingIntervalLimits = { .min = 100.0, .max = 3600.0 * 1000.0 },
27639  .lifeTimeCountLimits = { .max = 15000, .min = 3 },
27640  .keepAliveCountLimits = { .max = 100, .min = 1 },
27641  .maxNotificationsPerPublish = 1000,
27642  .maxRetransmissionQueueSize = 0, /* unlimited */
27643 
27644  /* Limits for MonitoredItems */
27645  .samplingIntervalLimits = { .min = 50.0, .max = 24.0 * 3600.0 * 1000.0 },
27646  .queueSizeLimits = { .max = 100, .min = 1 }
27647 };
27648 
27649 /***************************/
27650 /* Default Client Settings */
27651 /***************************/
27652 
27653 const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
27654  .timeout = 5000, /* 5 seconds */
27655  .secureChannelLifeTime = 10 * 60 * 1000, /* 10 minutes */
27656  .logger = UA_Log_Stdout,
27657  .localConnectionConfig = {
27658  .protocolVersion = 0,
27659  .sendBufferSize = 65535, /* 64k per chunk */
27660  .recvBufferSize = 65535, /* 64k per chunk */
27661  .maxMessageSize = 0, /* 0 -> unlimited */
27662  .maxChunkCount = 0 /* 0 -> unlimited */
27663  },
27664  .connectionFunc = UA_ClientConnectionTCP
27665 };
27666 /****************************************/
27667 /* Default Client Subscription Settings */
27668 /****************************************/
27669 
27670 #ifdef UA_ENABLE_SUBSCRIPTIONS
27671 
27672 const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
27673  .requestedPublishingInterval = 500.0,
27674  .requestedLifetimeCount = 10000,
27675  .requestedMaxKeepAliveCount = 1,
27676  .maxNotificationsPerPublish = 10,
27677  .publishingEnabled = true,
27678  .priority = 0
27679 };
27680 
27681 #endif
UA_Int32 i32
Definition: open62541.c:778
UA_EndpointDescription * serverEndpoints
Definition: open62541.h:5159
UA_String * profileUris
Definition: open62541.h:4470
UA_SecureChannel * channel
Definition: open62541.h:9482
#define UA_NS0ID_BROWSENEXTREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2131
#define LIST_HEAD(name, type)
Definition: open62541.c:197
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS
Definition: open62541.h:2612
#define UA_NS0ID_UNREGISTERNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2164
UA_StatusCode UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId, const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId, UA_Boolean isForward)
Definition: open62541.c:22328
void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session, const UA_TranslateBrowsePathsToNodeIdsRequest *request, UA_TranslateBrowsePathsToNodeIdsResponse *response)
Definition: open62541.c:23260
UA_StatusCode UA_Client_connect_username(UA_Client *client, const char *endpointUrl, const char *username, const char *password)
Definition: open62541.c:25267
UA_ResponseHeader responseHeader
Definition: open62541.h:4630
UA_NodeId authenticationToken
Definition: open62541.c:4752
#define UA_NS0ID_SERVERTYPE
Definition: open62541.h:2488
#define UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE
Definition: open62541.h:835
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4531
#define UA_NS0ID_MODIFYMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2361
WriteValue ^^^^^^^^^^.
Definition: open62541.h:3632
UA_StatusCode(* recv)(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout)
Definition: open62541.h:9516
size_t continuationPointsSize
Definition: open62541.h:4217
#define UA_TYPES_SETMONITORINGMODERESPONSE
Definition: open62541.h:4550
UA_VariantStorageType storageType
Definition: open62541.h:1401
UA_SecureChannelManager secureChannelManager
Definition: open62541.c:4216
void UA_Variant_setScalar(UA_Variant *v, void *UA_RESTRICT p, const UA_DataType *type)
Definition: open62541.c:5164
#define UA_STATUSCODE_BADDEADBANDFILTERINVALID
Definition: open62541.h:814
#define UA_STATUSCODE_UNCERTAININITIALVALUE
Definition: open62541.h:818
#define UA_EXPORT
Function Export On Win32: Define UA_DYNAMIC_LINKING and UA_DYNAMIC_LINKING_EXPORT in order to export ...
Definition: open62541.h:143
#define FLOAT_NEG_ZERO
Definition: open62541.c:6175
UA_UInt32 requestHandle
Definition: open62541.h:3303
#define UA_NodeStore_newVariableTypeNode()
Definition: open62541.c:3993
#define UA_STATUSCODE_BADVIEWPARAMETERMISMATCH
Definition: open62541.h:771
UA_Byte eventNotifier
Definition: open62541.h:3270
#define UA_NS0ID_ENUMERATION
Definition: open62541.h:1824
UA_Boolean symmetric
Definition: open62541.c:3653
SequenceHeader ^^^^^^^^^^^^^^ Secure Layer Sequence Header.
Definition: open62541.c:2617
struct UA_ExtensionObject::@1::@2 encoded
uint32_t UA_UInt32
UInt32 ^^^^^^ An integer value between 0 and 4 294 967 295.
Definition: open62541.h:970
#define UA_TYPES_METHODATTRIBUTES
Definition: open62541.h:3612
size_t arrayLength
Definition: open62541.h:1402
#define UA_BINARY_OVERLAYABLE_INTEGER
String Manipulation The header string.h is defined in the C-standard.
Definition: open62541.h:247
#define UA_STATUSCODE_BADDEVICEFAILURE
Definition: open62541.h:811
UA_Session adminSession
Definition: open62541.c:15612
#define UA_NS0ID_FROMSTATE
Definition: open62541.h:1843
void UA_SecureChannel_revolveTokens(UA_SecureChannel *channel)
Definition: open62541.c:15258
UA_UInt32 maxMessageSize
Definition: open62541.c:2552
#define UA_NS0ID_SERVERSTATUSDATATYPE
Definition: open62541.h:2448
#define UA_TYPES_SIGNATUREDATA
Definition: open62541.h:3693
UA_ResponseHeader responseHeader
Definition: open62541.h:4934
#define UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE
Definition: open62541.h:794
UA_QualifiedName targetName
Definition: open62541.h:3477
#define UA_STATUSCODE_BADEVENTFILTERINVALID
Definition: open62541.h:726
#define UA_NS0ID_BUILDINFO
Definition: open62541.h:1958
Definition: open62541.c:3706
#define container_of(ptr, type, member)
Definition: open62541.c:749
UA_StatusCode UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
Definition: open62541.c:15788
ApplicationDescription ^^^^^^^^^^^^^^^^^^^^^^ Describes an application and how to find it...
Definition: open62541.h:4906
#define UA_NS0ID_SERVER_VENDORSERVERINFO
Definition: open62541.h:2572
void Service_DeleteNodes(UA_Server *server, UA_Session *session, const UA_DeleteNodesRequest *request, UA_DeleteNodesResponse *response)
Definition: open62541.c:22386
UA_LogCategory
Definition: open62541.h:9639
UA_NodeId referenceTypeId
Definition: open62541.h:3474
UA_BrowsePathResult UA_Server_translateBrowsePathToNodeIds(UA_Server *server, const UA_BrowsePath *browsePath)
Definition: open62541.c:23250
#define NULL
size_t resultsSize
Definition: open62541.h:4202
#define UA_NS0ID_FINDSERVERSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2020
#define UA_TYPES_QUERYDATASET
Definition: open62541.h:3546
#define UA_OPEN62541_VER_LABEL
Definition: open62541.h:42
#define UA_STATUSCODE_BADSERVERNOTCONNECTED
Definition: open62541.h:666
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME
Definition: open62541.h:2547
TcpMessageHeader ^^^^^^^^^^^^^^^^ TCP Header.
Definition: open62541.c:2628
#define UA_NS0ID_ORGANIZES
Definition: open62541.h:1830
#define UA_STATUSCODE_UNCERTAINDATASUBNORMAL
Definition: open62541.h:846
UA_ApplicationType
ApplicationType ^^^^^^^^^^^^^^^ The types of applications.
Definition: open62541.h:4097
const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard
Definition: open62541.c:27563
UA_StatusCode UA_NodeStore_remove(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19461
UA_MonitoredItemNotification * monitoredItems
Definition: open62541.h:4507
#define UA_STATUSCODE_GOODDATAIGNORED
Definition: open62541.h:853
#define UA_STATUSCODE_BADENCODINGERROR
Definition: open62541.h:657
#define UA_TYPES_DELETEMONITOREDITEMSREQUEST
Definition: open62541.h:4363
UA_UInt16 typeIndex
Definition: open62541.h:1656
#define UA_TYPES_SETPUBLISHINGMODEREQUEST
Definition: open62541.h:3569
void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub)
#define UA_TYPES_MODIFYMONITOREDITEMSREQUEST
Definition: open62541.h:4536
#define UA_STATUSCODE_BADCERTIFICATEINVALID
Definition: open62541.h:672
UA_ByteString incompleteMessage
Definition: open62541.h:9488
#define UA_TYPES_DELETEREFERENCESITEM
Definition: open62541.h:3626
UA_Variant value
Definition: open62541.h:1574
#define APPLICATION_NAME
Definition: open62541.c:27578
void(* UA_Service)(UA_Server *, UA_Session *, const void *request, void *response)
Definition: open62541.c:4403
UA_StatusCode innerStatusCode
Definition: open62541.h:1600
UA_NodeStore * UA_NodeStore_new(void)
Nodestore Lifecycle ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:19336
UA_String endpointUrl
Definition: open62541.c:2554
#define UA_TYPES_SIGNEDSOFTWARECERTIFICATE
Definition: open62541.h:3246
#define STARTTOKENID
Definition: open62541.c:18631
#define LIST_NEXT(elm, field)
Definition: open62541.c:217
UA_AddNodesItem * nodesToAdd
Definition: open62541.h:4991
UA_MonitoredItem * UA_MonitoredItem_new(void)
UA_Boolean UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2)
Definition: open62541.c:4913
AddReferencesItem ^^^^^^^^^^^^^^^^^ A request to add a reference to the server address space...
Definition: open62541.h:4614
UA_StatusCode UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt32 channelId)
Definition: open62541.c:18802
#define UA_TYPES_READVALUEID
Definition: open62541.h:3880
#define UA_TYPES_BROWSEPATH
Definition: open62541.h:5019
UA_UInt32 requestId
Definition: open62541.c:3224
UA_String username
Definition: open62541.c:4747
UA_Boolean containsNoLoops
Definition: open62541.c:3688
UA_ByteString serverCertificate
Definition: open62541.h:5071
void UA_Client_reset(UA_Client *client)
Definition: open62541.c:24720
#define UA_NS0ID_REFERENCETYPESFOLDER
Definition: open62541.h:1869
UA_DateTime publishTime
Definition: open62541.h:3375
UA_StatusCode statusCode
Definition: open62541.h:5026
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3652
RelativePath ^^^^^^^^^^^^ A relative path constructed from reference types and browse names...
Definition: open62541.h:4657
UA_TcpMessageHeader messageHeader
Definition: open62541.c:2664
TranslateBrowsePathsToNodeIdsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Translates one or more path...
Definition: open62541.h:5125
UA_UInt32 size
Definition: open62541.c:19172
UA_QualifiedName browseName
Definition: open62541.h:4817
#define UA_STATUSCODE_BADCONDITIONALREADYDISABLED
Definition: open62541.h:824
struct UA_NodeStoreEntry * orig
Definition: open62541.c:19164
UA_DeleteNodesItem * nodesToDelete
Definition: open62541.h:3984
#define UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED
Definition: open62541.h:763
#define UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED
Definition: open62541.h:767
UA_String UA_ByteString
ByteString ^^^^^^^^^^ A sequence of octets.
Definition: open62541.h:1122
#define UA_STATUSCODE_BADINDEXRANGEINVALID
Definition: open62541.h:709
UA_Byte data4[8]
Definition: open62541.h:1111
#define UA_NS0ID_QUALIFIEDNAME
Definition: open62541.h:1815
size_t namespacesSize
Definition: open62541.c:4222
UA_StatusCode UA_Client_manuallyRenewSecureChannel(UA_Client *client)
Definition: open62541.c:25336
UA_LogLevel
Logging
Definition: open62541.h:9630
UA_NodeId dataType
Definition: open62541.h:3713
UA_StatusCode Subscription_unregisterPublishJob(UA_Server *server, UA_Subscription *sub)
#define UA_STATUSCODE_BADCERTIFICATEUNTRUSTED
Definition: open62541.h:680
void(* UA_deleteMembersSignature)(void *p, const UA_DataType *type)
Definition: open62541.c:5690
CreateSessionRequest ^^^^^^^^^^^^^^^^^^^^ Creates a new session with the server.
Definition: open62541.h:5038
UA_String securityPolicyUri
Definition: open62541.h:4347
size_t resultsSize
Definition: open62541.h:4775
UA_UInt32 userWriteMask
Definition: open62541.h:3960
void UA_Server_deleteAllRepeatedJobs(UA_Server *server)
Definition: open62541.c:18265
#define UA_NS0ID_OBJECTSFOLDER
Definition: open62541.h:1863
#define MAXBACKLOG
For the multithreaded mode, assume a single thread that periodically "gets work" from the network lay...
Definition: open62541.c:26943
struct UA_ExtensionObject::@1::@3 decoded
#define UA_STATUSCODE_BADCONTINUATIONPOINTINVALID
Definition: open62541.h:734
QueryFirstRequest ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5172
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION
Definition: open62541.h:2548
#define UA_NS0ID_BOOLEAN
Definition: open62541.h:1796
UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, UA_EditNodeCallback callback, const void *data)
Definition: open62541.c:17894
#define UA_TYPES_GUID
Guid ^^^^.
Definition: open62541.h:3169
#define UA_STATUSCODE_BADCONDITIONDISABLED
Definition: open62541.h:826
FindServersRequest ^^^^^^^^^^^^^^^^^^ Finds the servers known to the discovery server.
Definition: open62541.h:4556
#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2152
#define MAX_PICO_SECONDS
Definition: open62541.c:7033
UA_ResponseHeader responseHeader
Definition: open62541.h:4085
#define UA_STATUSCODE_BADOUTOFSERVICE
Definition: open62541.h:813
#define TAILQ_REMOVE(head, elm, field)
Definition: open62541.c:526
AddNodesItem ^^^^^^^^^^^^ A request to add a node to the server address space.
Definition: open62541.h:4813
#define UA_STATUSCODE_BADCONNECTIONREJECTED
Definition: open62541.h:867
SymmetricAlgorithmSecurityHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Layer Symmetric Algorithm He...
Definition: open62541.c:2653
#define UA_RCU_UNLOCK()
Definition: open62541.c:4187
UA_SecureChannel channel
Definition: open62541.c:4105
struct ServerNetworkLayerTCP::ConnectionMapping * mappings
UA_ExtensionObjectEncoding encoding
Definition: open62541.h:1548
UA_ByteString continuationPoint
Definition: open62541.h:5027
void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, const UA_ByteString *message)
Definition: open62541.c:17574
#define UA_NodeStore_newObjectTypeNode()
Definition: open62541.c:3991
#define CHECK_NODECLASS(CLASS)
Definition: open62541.c:20696
CreateMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4945
struct UA_Job::@5::@6 binaryMessage
#define TAILQ_FOREACH(var, head, field)
Definition: open62541.c:461
UA_StatusCode UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex)
Definition: open62541.c:25511
#define CHECK_DATATYPE_ARRAY(EXP_DT)
Definition: open62541.c:21007
ServiceFault ^^^^^^^^^^^^ The response returned by all services when there is a service level error...
Definition: open62541.h:4923
#define UA_NS0ID_CREATESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2059
#define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE
Definition: open62541.c:2611
#define UA_STATUSCODE_BADDISCONNECT
Definition: open62541.h:868
#define UA_NS0ID_VARIABLETYPESFOLDER
Definition: open62541.h:1867
UA_StatusCode UA_SecureChannel_processChunks(UA_SecureChannel *channel, const UA_ByteString *chunks, UA_ProcessMessageCallback callback, void *application)
Definition: open62541.c:15506
#define UA_TYPES_WRITEREQUEST
Definition: open62541.h:4416
UA_CallMethodResult UA_EXPORT UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request)
Method Call
#define UA_STATUSCODE_BADINTERNALERROR
Definition: open62541.h:653
UA_MonitoringMode
MonitoringMode ^^^^^^^^^^^^^^.
Definition: open62541.h:3429
CreateSubscriptionRequest ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4227
struct UA_MonitoredItem UA_MonitoredItem
UA_ChannelSecurityToken securityToken
Definition: open62541.h:4087
#define UA_TYPES_ACTIVATESESSIONREQUEST
Definition: open62541.h:4078
#define UA_INT32_MAX
Definition: open62541.h:964
#define UA_TYPES_GETENDPOINTSREQUEST
Definition: open62541.h:4473
bool UA_Boolean
Boolean ^^^^^^^ A two-state logical value (true or false).
Definition: open62541.h:922
#define UA_TYPES_DATAVALUE
DataValue ^^^^^^^^^.
Definition: open62541.h:3223
void UA_Client_delete(UA_Client *client)
Definition: open62541.c:24725
#define UA_NS0ID_BASEDATATYPE
Definition: open62541.h:1819
#define UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER
Definition: open62541.h:776
DiagnosticInfo ^^^^^^^^^^^^^^ A structure that contains detailed error and diagnostic information ass...
Definition: open62541.h:1587
#define UA_TYPES_INT16
Int16 ^^^^^.
Definition: open62541.h:3109
#define SIMPLEQ_ENTRY(type)
Definition: open62541.c:289
#define UA_TRANSPORT_TCPHELLOMESSAGE
Definition: open62541.c:2557
UA_DateTime UA_DateTime_now(void)
Definition: open62541.c:27465
DataTypeAttributes ^^^^^^^^^^^^^^^^^^ The attributes for a data type node.
Definition: open62541.h:3886
#define UA_INLINE
Inline Functions
Definition: open62541.h:152
TcpAcknowledgeMessage ^^^^^^^^^^^^^^^^^^^^^ Acknowledge Message.
Definition: open62541.c:2603
UA_StatusCode UA_SessionManager_createSession(UA_SessionManager *sm, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_Session **session)
Definition: open62541.c:18908
#define LEAPOCH
Definition: open62541.c:26302
UA_StatusCode UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_VariableAttributes attr, const UA_DataSource dataSource, UA_NodeId *outNewNodeId)
Definition: open62541.c:22074
UA_StatusCode UA_Client_connect(UA_Client *client, const char *endpointUrl)
Definition: open62541.c:25277
UA_StatusCode UA_Client_disconnect(UA_Client *client)
Definition: open62541.c:25322
const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL
Definition: open62541.c:4785
#define UA_TYPES_PUBLISHREQUEST
Definition: open62541.h:4485
struct MonitoredItem_queuedValue MonitoredItem_queuedValue
UA_ServerCallback method
Definition: open62541.h:9594
const UA_DataType * responseType
Definition: open62541.c:25352
UA_RelativePathElement * elements
Definition: open62541.h:4659
UA_UInt16 milliSec
Definition: open62541.h:1090
QueryNextRequest ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4188
UA_StatusCode UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
Definition: open62541.c:25552
#define UA_STATUSCODE_BADNODEIDUNKNOWN
Definition: open62541.h:707
#define UA_TYPES_OPENSECURECHANNELREQUEST
Definition: open62541.h:4297
#define UA_NS0ID_SERVER_SERVERSTATUS_STATE
Definition: open62541.h:2543
#define UA_STATUSCODE_BADWOULDBLOCK
Definition: open62541.h:876
UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node)
Insert / Get / Replace / Remove ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:19379
#define UA_NS0ID_HASENCODING
Definition: open62541.h:1833
#define UA_NS0ID_NONHIERARCHICALREFERENCES
Definition: open62541.h:1827
SignatureData ^^^^^^^^^^^^^ A digital signature.
Definition: open62541.h:3688
#define UA_TYPES_CLOSESECURECHANNELRESPONSE
Definition: open62541.h:4522
DeleteSubscriptionsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3917
#define UA_STATUSCODE_BADINDEXRANGENODATA
Definition: open62541.h:710
UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19444
UA_Double revisedSessionTimeout
Definition: open62541.h:5155
#define UA_STATUSCODE_GOODENTRYREPLACED
Definition: open62541.h:845
size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number)
Definition: open62541.c:15137
UA_ServerState state
Definition: open62541.h:4832
UA_UserTokenType tokenType
Definition: open62541.h:4344
UA_DataValue value
Definition: open62541.h:3636
#define UA_TYPES_WRITERESPONSE
Definition: open62541.h:4208
#define UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID
Definition: open62541.h:722
double UA_Double
Double ^^^^^^ An IEEE double precision (64 bit) floating point value.
Definition: open62541.h:1001
MonitoredItemModifyResult ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3316
#define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3787
#define SLIST_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:150
#define UA_NS0ID_INT64
Definition: open62541.h:1803
UA_MonitoredItemCreateResult * results
Definition: open62541.h:4685
UA_ResponseHeader responseHeader
Definition: open62541.h:5152
#define UA_STATUSCODE_BADSTATENOTACTIVE
Definition: open62541.h:795
#define UA_STATUSCODE_BADTARGETNODEIDINVALID
Definition: open62541.h:762
#define SLIST_REMOVE(head, elm, type, field)
Definition: open62541.c:180
void * handle
Definition: open62541.h:9487
#define UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE
Definition: open62541.h:4282
#define UA_STATUSCODE_BADDIALOGNOTACTIVE
Definition: open62541.h:829
UA_Boolean executable
Definition: open62541.h:3608
#define UA_NS0ID_HASMODELLINGRULE
Definition: open62541.h:1832
UA_StatusCode __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, void *v)
Definition: open62541.c:20949
#define UA_NS0ID_SERVER_AUDITING
Definition: open62541.h:2635
#define UA_STATUSCODE_BADBROWSENAMEDUPLICATED
Definition: open62541.h:758
#define UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT
Definition: open62541.h:3867
ReferenceDescription ^^^^^^^^^^^^^^^^^^^^ The description of a reference.
Definition: open62541.h:4571
UA_UInt16 sourcePicoseconds
Definition: open62541.h:1577
#define UA_TYPES_USERIDENTITYTOKEN
Definition: open62541.h:3730
#define UA_STATUSCODE_BADINVALIDSELFREFERENCE
Definition: open62541.h:764
#define UA_STATUSCODE_GOODMOREDATA
Definition: open62541.h:848
#define SLIST_ENTRY(type)
Definition: open62541.c:132
UA_ResponseHeader responseHeader
Definition: open62541.h:5087
UA_DateTime timestamp
Definition: open62541.h:3302
UA_String transportProfileUri
Definition: open62541.h:5076
#define UA_STATUSCODE_BADTOOMANYMATCHES
Definition: open62541.h:777
UA_Client_Authentication
Definition: open62541.c:4726
#define UA_NS0ID_SERVER_SERVERREDUNDANCY
Definition: open62541.h:2573
void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request, UA_UnregisterNodesResponse *response)
Definition: open62541.c:23299
UA_Int32 symbolicId
Definition: open62541.h:1595
#define UA_TYPES_INT32
Int32 ^^^^^.
Definition: open62541.h:3121
#define UA_NodeStore_newReferenceTypeNode()
Definition: open62541.c:3995
#define UA_STATUSCODE_BADRESPONSETOOLARGE
Definition: open62541.h:661
#define UA_NS0ID_ADDREFERENCESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2092
#define UA_STATUSCODE_BADUSERSIGNATUREINVALID
Definition: open62541.h:747
const UA_ObjectTypeNode * getObjectNodeType(UA_Server *server, const UA_ObjectNode *node)
Definition: open62541.c:17869
BrowseNextRequest ^^^^^^^^^^^^^^^^^ Continues one or more browse operations.
Definition: open62541.h:4214
UA_ResponseHeader responseHeader
Definition: open62541.h:4304
size_t UA_calcSizeBinary(void *p, const UA_DataType *type)
Definition: open62541.c:7563
#define UA_STATUSCODE_BADREFERENCETYPEIDINVALID
Definition: open62541.h:736
UA_Guid UA_Guid_random(void)
Definition: open62541.c:4920
#define UA_NS0ID_INTEGER
Definition: open62541.h:1822
UA_StatusCode MonitoredItem_registerSampleJob(UA_Server *server, UA_MonitoredItem *mon)
#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED
Definition: open62541.h:684
#define UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID
Definition: open62541.h:695
#define SIMPLEQ_FIRST(head)
Definition: open62541.c:297
const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7177
UA_StatusCode getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse, UA_NodeId **typeHierarchy, size_t *typeHierarchySize)
Definition: open62541.c:17727
#define UA_TYPES_COUNT
Every type is assigned an index in an array containing the type descriptions.
Definition: open62541.h:3084
UA_Session * UA_SecureChannel_getSession(UA_SecureChannel *channel, UA_NodeId *token)
Definition: open62541.c:15247
UA_SecureChannel channel
Definition: open62541.c:4741
UA_ResponseHeader responseHeader
Definition: open62541.h:4201
#define UA_OPEN62541_VER_MAJOR
Library Version
Definition: open62541.h:39
#define CLOSESOCKET(S)
Definition: open62541.c:26717
#define UA_NS0ID_HASPROPERTY
Definition: open62541.h:1839
DeleteReferencesRequest ^^^^^^^^^^^^^^^^^^^^^^^ Delete one or more references from the server address...
Definition: open62541.h:4747
#define UA_NS0ID_INT16
Definition: open62541.h:1799
Argument ^^^^^^^^ An argument for a method.
Definition: open62541.h:3711
#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE
Definition: open62541.c:6632
size_t subscriptionAcknowledgementsSize
Definition: open62541.h:4481
#define UA_NS0ID_HASDESCRIPTION
Definition: open62541.h:1834
UA_UInt16 memberTypeIndex
Definition: open62541.h:1635
UserNameIdentityToken ^^^^^^^^^^^^^^^^^^^^^ A token representing a user identified by a user name and...
Definition: open62541.h:4023
UA_UInt32 * arrayDimensions
Definition: open62541.h:1405
UA_StatusCode writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node, const UA_NodeId *dataType, const UA_NodeId *constraintDataType)
Definition: open62541.c:20406
UA_Byte userAccessLevel
Definition: open62541.c:3464
#define UA_TYPES_CLOSESESSIONRESPONSE
Definition: open62541.h:4900
#define UA_NS0ID_MODIFYSUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2391
void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, UA_Session *session, const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response)
Definition: open62541.c:19943
UA_Boolean overlayable
Definition: open62541.h:1662
UA_ExtensionObject additionalHeader
Definition: open62541.h:3908
#define UA_STATUSCODE_BADNOCONTINUATIONPOINTS
Definition: open62541.h:735
UA_StatusCode UA_SessionManager_removeSession(UA_SessionManager *sm, const UA_NodeId *token)
Definition: open62541.c:18935
#define UA_NS0ID_HASORDEREDCOMPONENT
Definition: open62541.h:1842
#define UA_TYPES_DATACHANGEFILTER
Definition: open62541.h:4878
#define UA_STATUSCODE_BADTYPEMISMATCH
Definition: open62541.h:786
UA_Double timeout
Definition: open62541.c:3733
UA_RequestHeader requestHeader
Definition: open62541.h:4316
UA_BrowseDirection browseDirection
Definition: open62541.h:4439
UA_NodeId referenceTypeId
Definition: open62541.h:3700
#define UA_STATUSCODE_BADTCPINTERNALERROR
Definition: open62541.h:801
#define UA_STATUSCODE_BADTCPMESSAGETOOLARGE
Definition: open62541.h:799
void * UA_Array_new(size_t size, const UA_DataType *type)
Definition: open62541.c:5762
CallMethodResult ^^^^^^^^^^^^^^^^.
Definition: open62541.h:3443
#define UA_TYPES_UINT32
UInt32 ^^^^^^.
Definition: open62541.h:3127
UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char *name)
Definition: open62541.c:15779
UA_StatusCode compatibleArrayDimensions(size_t constraintArrayDimensionsSize, const UA_UInt32 *constraintArrayDimensions, size_t testArrayDimensionsSize, const UA_UInt32 *testArrayDimensions)
Definition: open62541.c:20127
AsymmetricAlgorithmSecurityHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Security Header.
Definition: open62541.c:2591
TcpErrorMessage ^^^^^^^^^^^^^^^ Error Message.
Definition: open62541.c:2563
UA_Boolean processed
Definition: open62541.c:25349
#define UA_STATUSCODE_BADNOTIMPLEMENTED
Definition: open62541.h:719
UA_NODE_BASEATTRIBUTES UA_NODE_VARIABLEATTRIBUTES UA_Byte accessLevel
Definition: open62541.c:3463
UA_ExtensionObjectEncoding
Definition: open62541.h:1537
size_t nodesToWriteSize
Definition: open62541.h:4412
UA_VARIANT_ENCODINGMASKTYPE
Definition: open62541.c:6852
#define UA_TYPES_BYTESTRING
ByteString ^^^^^^^^^^.
Definition: open62541.h:3175
UA_UInt32 u32
Definition: open62541.c:777
SignedSoftwareCertificate ^^^^^^^^^^^^^^^^^^^^^^^^^ A software certificate with a digital signature...
Definition: open62541.h:3241
#define UA_STATUSCODE_BADVIEWIDUNKNOWN
Definition: open62541.h:769
#define UA_STATUSCODE_BADNODEATTRIBUTESINVALID
Definition: open62541.h:759
#define UA_TYPES_UINT64
UInt64 ^^^^^^.
Definition: open62541.h:3139
UA_LocalizedText displayName
Definition: open62541.h:3352
#define UA_UINT16_MAX
Definition: open62541.h:956
#define UA_STATUSCODE_BADDATALOST
Definition: open62541.h:839
#define UA_STATUSCODE_BADDEPENDENTVALUECHANGED
Definition: open62541.h:861
#define UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN
Definition: open62541.h:2633
UA_Boolean UA_Node_hasSubTypeOrInstances(const UA_Node *node)
Definition: open62541.c:17877
UA_String * namespaces
Definition: open62541.c:4223
UA_DataValue * results
Definition: open62541.h:4776
UA_UInt32 requestId
Definition: open62541.c:2619
#define UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT
Definition: open62541.h:698
#define UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID
Definition: open62541.h:676
#define UA_STATUSCODE_GOODCALLAGAIN
Definition: open62541.h:864
UA_UInt32 maxRequestMessageSize
Definition: open62541.c:3731
ReadValueId ^^^^^^^^^^^.
Definition: open62541.h:3873
UA_String UA_String_fromChars(char const src[])
Definition: open62541.c:4822
#define CHECK_NODECLASS_WRITE(CLASS)
Definition: open62541.c:21015
#define UA_NS0ID_INT32
Definition: open62541.h:1801
const UA_DataType * UA_findDataType(const UA_NodeId *typeId)
Builtin data types can be accessed as UA_TYPES[UA_TYPES_XXX], where XXX is the name of the data type...
Definition: open62541.c:4790
UA_String additionalInfo
Definition: open62541.h:1599
UA_Int64 i64
Definition: open62541.c:780
#define UA_STATUSCODE_BADDATAENCODINGINVALID
Definition: open62541.h:711
UA_StatusCode UA_SecureChannel_generateNonce(UA_ByteString *nonce)
Definition: open62541.c:15202
UA_String indexRange
Definition: open62541.h:3635
const UA_NodeId UA_NODEID_NULL
Definition: open62541.c:4784
UA_ExtensionObject filter
Definition: open62541.h:3677
#define UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE
Definition: open62541.h:685
#define UA_STATUSCODE_BADSESSIONIDINVALID
Definition: open62541.h:692
#define DOUBLE_INF
Definition: open62541.c:6208
UA_Connection connection
Definition: open62541.c:4737
uint16_t UA_UInt16
UInt16 ^^^^^^ An integer value between 0 and 65 535.
Definition: open62541.h:954
#define UA_STATUSCODE_BADBROWSENAMEINVALID
Definition: open62541.h:757
#define UA_STATUSCODE_GOODNODATA
Definition: open62541.h:847
#define UA_NS0ID_UINTEGER
Definition: open62541.h:1823
#define UA_NS0ID_HASCAUSE
Definition: open62541.h:1845
UA_LocalizedText inverseName
Definition: open62541.h:4377
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBROWSECONTINUATIONPOINTS
Definition: open62541.h:2611
#define UA_NS0ID_BASEDATAVARIABLETYPE
Definition: open62541.h:1851
UA_ExtensionObject nodeAttributes
Definition: open62541.h:4819
UA_Boolean hasLocalizedText
Definition: open62541.h:1590
UA_UInt16 data3
Definition: open62541.h:1110
OpenSecureChannelResponse ^^^^^^^^^^^^^^^^^^^^^^^^^ Creates a secure channel with a server...
Definition: open62541.h:4084
void Service_Read_single(UA_Server *server, UA_Session *session, UA_TimestampsToReturn timestamps, const UA_ReadValueId *id, UA_DataValue *v)
Definition: open62541.c:20702
UA_ClientState UA_Client_getState(UA_Client *client)
Definition: open62541.c:24730
UA_Boolean fixedSize
Definition: open62541.h:1660
UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data)
Definition: open62541.c:18282
#define UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED
Definition: open62541.h:843
UA_Boolean hasSourcePicoseconds
Definition: open62541.h:1572
struct UA_DiagnosticInfo * innerDiagnosticInfo
Definition: open62541.h:1601
AddNodesRequest ^^^^^^^^^^^^^^^ Adds one or more nodes to the server address space.
Definition: open62541.h:4988
#define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3780
#define UA_TYPES_CREATESUBSCRIPTIONREQUEST
Definition: open62541.h:4237
#define UA_NS0ID_VIEWSFOLDER
Definition: open62541.h:1865
#define UA_TYPES_CALLMETHODRESULT
Definition: open62541.h:3453
UA_AsymmetricAlgorithmSecurityHeader clientAsymAlgSettings
Definition: open62541.c:3236
#define UA_TYPES_PUBLISHRESPONSE
Definition: open62541.h:4006
UA_QualifiedName browseName
Definition: open62541.h:4575
RequestHeader ^^^^^^^^^^^^^ The header passed with every server request.
Definition: open62541.h:3300
UA_SecurityTokenRequestType requestType
Definition: open62541.h:4291
#define ADDPROFILEARRAY(x)
UA_StatusCode UA_Subscription_deleteMonitoredItem(UA_Server *server, UA_Subscription *sub, UA_UInt32 monitoredItemID)
UA_UInt32 protocolVersion
Definition: open62541.c:2549
Definition: open62541.c:3215
#define UA_TYPES_RELATIVEPATH
Definition: open62541.h:4662
UA_StatusCode UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_Connection *conn, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
Definition: open62541.c:18711
#define UA_NS0ID_GENERATESEVENT
Definition: open62541.h:1836
#define UA_NS0ID_GETENDPOINTSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2026
UA_UInt32 maxMessageSize
Definition: open62541.h:9453
#define UA_TYPES_BROWSERESPONSE
Definition: open62541.h:5145
#define UA_TYPES_FINDSERVERSRESPONSE
Definition: open62541.h:4939
#define UA_STATUSCODE_BADTIMEOUT
Definition: open62541.h:663
UA_UInt16 namespaceIndex
Definition: open62541.h:1288
#define FNV_PRIME_32
Definition: open62541.c:5040
#define UA_TYPES_MODIFYSUBSCRIPTIONREQUEST
Definition: open62541.h:4336
AddNodesResponse ^^^^^^^^^^^^^^^^ Adds one or more nodes to the server address space.
Definition: open62541.h:4491
#define UA_STATUSCODE_BADNOVALIDCERTIFICATES
Definition: open62541.h:749
#define UA_TYPES_SBYTE
SByte ^^^^^.
Definition: open62541.h:3097
#define errno__
Definition: open62541.c:26764
struct channel_list_entry channel_list_entry
#define UA_TYPES_ADDNODESITEM
Definition: open62541.h:4823
void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session, const UA_DeleteMonitoredItemsRequest *request, UA_DeleteMonitoredItemsResponse *response)
SetPublishingModeRequest ^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3562
const UA_Guid UA_GUID_NULL
Definition: open62541.c:4783
#define UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED
Definition: open62541.h:723
UA_StatusCode * results
Definition: open62541.h:4713
#define UA_TYPES_DELETENODESRESPONSE
Definition: open62541.h:4718
UA_BrowseResult UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr)
Browsing
Definition: open62541.c:22901
UA_Double requestedPublishingInterval
Definition: open62541.h:4229
#define TAILQ_LAST(head, headname)
Definition: open62541.c:453
UA_StatusCode readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v)
Definition: open62541.c:20518
#define UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST
Definition: open62541.h:751
void UA_NodeStore_deleteNode(UA_Node *node)
Definition: open62541.c:19372
#define UA_NS0ID_SERVERCAPABILITIESTYPE
Definition: open62541.h:2489
const UA_DataType * type
Definition: open62541.h:1400
RegisterNodesResponse ^^^^^^^^^^^^^^^^^^^^^ Registers one or more nodes for repeated use within a ses...
Definition: open62541.h:4303
UA_ResponseHeader responseHeader
Definition: open62541.h:3994
int64_t UA_DateTime
Definition: open62541.h:1070
UA_Int32 sockfd
Definition: open62541.h:9484
UA_MonitoredItemModifyResult * results
Definition: open62541.h:4762
DeleteMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3941
UA_StatusCode writeValueAttribute(UA_Server *server, UA_VariableNode *node, const UA_DataValue *value, const UA_String *indexRange)
Definition: open62541.c:20567
#define UA_TYPES_CONTENTFILTER
Definition: open62541.h:4964
#define UA_TRANSPORT_MESSAGETYPE
Definition: open62541.c:2585
UA_UInt32 secondsTillShutdown
Definition: open62541.h:4834
#define UA_NS0ID_PUBLISHREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2418
#define UA_TYPES_ARGUMENT
Definition: open62541.h:3720
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: open62541.c:492
UA_Int16 i16
Definition: open62541.c:776
UA_Node node
Definition: open62541.c:19165
void UA_Array_delete(void *p, size_t size, const UA_DataType *type)
Definition: open62541.c:5808
#define UA_STATUSCODE_BADNOTCONNECTED
Definition: open62541.h:810
#define UA_TYPES_ADDREFERENCESITEM
Definition: open62541.h:4623
#define UA_STATUSCODE_BADSERVERHALTED
Definition: open62541.h:667
ContentFilterResult ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4601
UA_Client * client
Definition: open62541.c:25348
UA_SByte i8
Definition: open62541.c:774
ReferenceNode ^^^^^^^^^^^^^ Specifies a reference which belongs to a node.
Definition: open62541.h:3699
#define UA_TYPES_MESSAGESECURITYMODE
Definition: open62541.h:3668
UA_DataChangeTrigger trigger
Definition: open62541.h:4873
UA_EndpointDescription * endpoints
Definition: open62541.h:5089
UA_String sessionName
Definition: open62541.c:3728
UA_ByteString clientNonce
Definition: open62541.c:3238
UA_AddReferencesItem * referencesToAdd
Definition: open62541.h:4790
#define UA_STATUSCODE_BADREQUESTTIMEOUT
Definition: open62541.h:804
UA_UInt16 memSize
Definition: open62541.h:1655
UA_Boolean includeSubtypes
Definition: open62541.h:3476
#define UA_NS0ID_HASCOMPONENT
Definition: open62541.h:1840
Definition: open62541.c:4062
#define UA_STATUSCODE_BADOUTOFRANGE
Definition: open62541.h:715
#define UA_STATUSCODE_BADQUERYTOOCOMPLEX
Definition: open62541.h:778
size_t length
Definition: open62541.h:1039
UA_UInt32 retransmitSequenceNumber
Definition: open62541.h:4455
UA_ExpandedNodeId typeDefinition
Definition: open62541.h:4820
#define UA_STATUSCODE_BADHISTORYOPERATIONINVALID
Definition: open62541.h:782
UA_StatusCode Subscription_registerPublishJob(UA_Server *server, UA_Subscription *sub)
ReadRequest ^^^^^^^^^^^.
Definition: open62541.h:4799
UA_MonitoringParameters requestedParameters
Definition: open62541.h:4738
GetEndpointsResponse ^^^^^^^^^^^^^^^^^^^^ Gets the endpoints used by the server.
Definition: open62541.h:5086
#define UA_STATUSCODE_BADREFRESHINPROGRESS
Definition: open62541.h:823
UA_UInt16 data2
Definition: open62541.h:1109
UA_ApplicationDescription * servers
Definition: open62541.h:4936
#define UA_TYPES_ADDNODESREQUEST
Definition: open62541.h:4994
UA_ChannelSecurityToken securityToken
Definition: open62541.c:3234
#define UA_TYPES_CREATESESSIONRESPONSE
Definition: open62541.h:5166
CallResponse ^^^^^^^^^^^^.
Definition: open62541.h:4696
uint64_t UA_UInt64
UInt64 ^^^^^^ An integer value between 0 and 18 446 744 073 709 551 615.
Definition: open62541.h:987
#define UA_TYPES_DELETEREFERENCESRESPONSE
Definition: open62541.h:4676
#define UA_STATUSCODE_BADFILTERELEMENTINVALID
Definition: open62541.h:732
#define UA_NODEIDTYPE_NUMERIC_TWOBYTE
Definition: open62541.c:6454
#define TAILQ_ENTRY(type)
Definition: open62541.c:441
UA_StatusCode UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId, const UA_DataSource dataSource)
Definition: open62541.c:22553
#define UA_STATUSCODE_BADDIALOGRESPONSEINVALID
Definition: open62541.h:830
#define DAYS_PER_400Y
Definition: open62541.c:26304
UA_StatusCode(* UA_exchangeEncodeBuffer)(void *handle, UA_ByteString *buf, size_t offset)
Definition: open62541.c:853
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI
Definition: open62541.h:2546
SecureConversationMessageAbortBody ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Conversation Message Abo...
Definition: open62541.c:2525
SetMonitoringModeRequest ^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4386
void() UA_ProcessMessageCallback(void *application, UA_SecureChannel *channel, UA_MessageType messageType, UA_UInt32 requestId, const UA_ByteString *message)
Chunking
Definition: open62541.c:3265
#define DOUBLE_NEG_ZERO
Definition: open62541.c:6210
#define UA_STATUSCODE_BADMONITOREDITEMIDINVALID
Definition: open62541.h:721
#define UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED
Definition: open62541.h:852
UA_Boolean activated
Definition: open62541.c:3727
#define UA_TYPES_FLOAT
Float ^^^^^.
Definition: open62541.h:3145
#define UA_STATUSCODE_BADTOOMANYSESSIONS
Definition: open62541.h:746
#define UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED
Definition: open62541.h:750
#define UA_INT64_MAX
Definition: open62541.h:981
UA_Boolean containsNoLoops
Definition: open62541.h:3269
void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
SecureChannel Service Set This Service Set defines Services used to open a communication channel that...
Definition: open62541.c:19850
#define UA_TYPES_REPUBLISHRESPONSE
Definition: open62541.h:4729
UA_StatusCode * results
Definition: open62541.h:4203
#define UA_free(_p_ptr)
UA_Boolean deleteBidirectional
Definition: open62541.h:3623
UA_DateTime timestamp
Definition: open62541.h:3902
UA_DateTime sourceTimestamp
Definition: open62541.h:1576
size_t(* getJobs)(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt16 timeout)
Definition: open62541.h:9786
UA_DateTime nextChannelRenewal
Definition: open62541.c:4743
#define UA_TYPES_MONITOREDITEMMODIFYREQUEST
Definition: open62541.h:4017
UA_NodeId authenticationToken
Definition: open62541.h:5154
#define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3286
#define UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS
Definition: open62541.h:2771
void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server)
Definition: open62541.c:15646
#define UA_STATUSCODE_GOODNONCRITICALTIMEOUT
Definition: open62541.h:865
DeleteNodesRequest ^^^^^^^^^^^^^^^^^^ Delete one or more nodes from the server address space...
Definition: open62541.h:3981
#define UA_TYPES_READRESPONSE
Definition: open62541.h:4781
#define UA_STATUSCODE_BADNOTSUPPORTED
Definition: open62541.h:716
ContentFilter ^^^^^^^^^^^^^.
Definition: open62541.h:4959
UA_Variant * inputArguments
Definition: open62541.h:3504
UA_Server * UA_Server_new(const UA_ServerConfig config)
Definition: open62541.c:16134
#define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3794
SetPublishingModeResponse ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4587
status(* UA_decodeBinarySignature)(void *UA_RESTRICT dst, const UA_DataType *type)
Definition: open62541.c:5867
UA_String reason
Definition: open62541.c:2565
UA_MessageSecurityMode securityMode
Definition: open62541.h:5072
#define UA_NODESTORE_TOMBSTONE
Definition: open62541.c:19168
#define UA_STATUSCODE_BADNODEIDEXISTS
Definition: open62541.h:755
#define UA_TYPES_MONITOREDITEMCREATEREQUEST
Definition: open62541.h:4741
#define UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE
Definition: open62541.h:819
const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7263
#define UA_NS0ID_WRITEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2271
#define UA_NS0ID_SERVER
Definition: open62541.h:2537
UA_EndpointDescription * endpointDescriptions
Definition: open62541.c:4213
UA_MonitoringParameters requestedParameters
Definition: open62541.h:4014
UA_ResponseHeader responseHeader
Definition: open62541.h:4644
#define UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT
Definition: open62541.h:784
BuildInfo ^^^^^^^^^.
Definition: open62541.h:3792
#define UA_NS0ID_FLOAT
Definition: open62541.h:1805
UA_UInt32 resultMask
Definition: open62541.h:4443
UA_StatusCode UA_Client_writeArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_UInt32 *newArrayDimensions, size_t newArrayDimensionsSize)
Definition: open62541.c:25811
UA_ResponseHeader responseHeader
Definition: open62541.h:4145
QueryDataSet ^^^^^^^^^^^^.
Definition: open62541.h:3539
#define UA_TYPES_READREQUEST
Definition: open62541.h:4807
#define USERNAME_POLICY
Definition: open62541.c:4156
void UA_NodeStore_iterate(UA_NodeStore *ns, UA_NodeStore_nodeVisitor visitor)
Definition: open62541.c:19475
const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard
Definition: open62541.c:27653
#define UA_STATUSCODE_BADAGGREGATELISTMISMATCH
Definition: open62541.h:849
#define UA_STATUSCODE_BADOPERATIONABANDONED
Definition: open62541.h:874
void UA_SecureChannel_init(UA_SecureChannel *channel)
Definition: open62541.c:15163
#define UA_TYPES_USERNAMEIDENTITYTOKEN
Definition: open62541.h:4030
UA_StatusCode __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, const UA_DataType *attr_type, const void *attr)
Definition: open62541.c:21179
#define SLIST_INSERT_HEAD(head, elm, field)
Definition: open62541.c:167
UA_ObjectLifecycleManagement lifecycleManagement
Definition: open62541.c:3545
#define UA_TYPES_BROWSEREQUEST
Definition: open62541.h:5008
#define UA_STATUSCODE_BADREFERENCELOCALONLY
Definition: open62541.h:765
#define UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED
Definition: open62541.h:659
UA_Boolean final
Definition: open62541.c:3228
#define UA_EXPANDEDNODEID_SERVERINDEX_FLAG
Definition: open62541.c:6458
void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *request, UA_CallResponse *response)
void UA_SessionManager_cleanupTimedOut(UA_SessionManager *sm, UA_DateTime nowMonotonic)
Definition: open62541.c:18867
UA_UInt32 requestedMaxReferencesPerNode
Definition: open62541.h:5003
ReferenceTypeAttributes ^^^^^^^^^^^^^^^^^^^^^^^ The attributes for a reference type node...
Definition: open62541.h:4369
#define UA_STATUSCODE_BADTOOMANYOPERATIONS
Definition: open62541.h:669
DeleteNodesResponse ^^^^^^^^^^^^^^^^^^^ Delete one or more nodes from the server address space...
Definition: open62541.h:4710
#define UA_STATUSCODE_GOODDEPENDENTVALUECHANGED
Definition: open62541.h:858
UA_NodeClass targetNodeClass
Definition: open62541.h:4620
UA_ExpandedNodeId typeDefinition
Definition: open62541.h:4578
#define TAILQ_INIT(head)
Definition: open62541.c:487
#define UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT
Definition: open62541.h:2662
UA_Connection * connection
Definition: open62541.c:3242
UA_ResponseHeader responseHeader
Definition: open62541.h:5112
#define UA_NS0ID_SBYTE
Definition: open62541.h:1797
TranslateBrowsePathsToNodeIdsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Translates one or more pa...
Definition: open62541.h:4858
#define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3281
UA_UInt16 nanoSec
Definition: open62541.h:1088
UA_Connection UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl, UA_Logger logger)
Definition: open62541.c:27330
UA_Node * UA_NodeStore_newNode(UA_NodeClass nodeClass)
Node Lifecycle ^^^^^^^^^^^^^^.
Definition: open62541.c:19364
#define UA_NS0ID_DATATYPESFOLDER
Definition: open62541.h:1868
UA_String password
Definition: open62541.c:4748
UA_Boolean isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind, const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize)
Definition: open62541.c:17801
#define UA_STATUSCODE_BADMESSAGENOTAVAILABLE
Definition: open62541.h:793
#define APPLICATION_URI
Definition: open62541.c:27579
#define UA_TYPES_ADDNODESRESPONSE
Definition: open62541.h:4499
void Service_Publish(UA_Server *server, UA_Session *session, const UA_PublishRequest *request, UA_UInt32 requestId)
UA_StatusCode UA_Variant_setRangeCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range)
Definition: open62541.c:5500
#define UA_TYPES_PARSINGRESULT
Definition: open62541.h:3467
#define UA_PRINTF_GUID_DATA(GUID)
Definition: open62541.h:9727
#define INTERRUPTED
Definition: open62541.c:26765
#define UA_NS0ID_STRING
Definition: open62541.h:1807
#define UA_NS0ID_UINT64
Definition: open62541.h:1804
UA_UInt32 messageType
Definition: open62541.c:3225
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE
Definition: open62541.h:2555
void UA_SecureChannelManager_deleteMembers(UA_SecureChannelManager *cm)
Definition: open62541.c:18643
#define UA_ASSERT_RCU_UNLOCKED()
Definition: open62541.c:4189
#define UA_SEC_TO_DATETIME
Definition: open62541.h:1075
void(* UA_ServerCallback)(UA_Server *server, void *data)
Definition: open62541.h:9574
UA_UInt32 maxResponseMessageSize
Definition: open62541.h:5047
UA_UInt16 nThreads
Definition: open62541.h:9822
UA_StatusCode UA_Server_run_startup(UA_Server *server)
Definition: open62541.c:18448
UA_UInt16 u16
Definition: open62541.c:775
ViewDescription ^^^^^^^^^^^^^^^ The view to browse.
Definition: open62541.h:3929
#define UA_NS0ID_REFERENCES
Definition: open62541.h:1826
#define UA_NS0ID_DELETENODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2098
#define UA_STATUSCODE_BADREQUESTINTERRUPTED
Definition: open62541.h:803
void(* UA_NodeStore_nodeVisitor)(const UA_Node *node)
Iteration ^^^^^^^^^ The following definitions are used to call a callback for every node in the nodes...
Definition: open62541.c:4046
#define UA_TYPES_STRING
String ^^^^^^.
Definition: open62541.h:3157
uint32_t pcg32_random_r(pcg32_random_t *rng)
Definition: open62541.c:26414
RepublishResponse ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4724
#define UA_NS0ID_LOCALIZEDTEXT
Definition: open62541.h:1816
UA_NodeId nodeId
Definition: open62541.h:3852
CreateSubscriptionResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4629
BrowseResponse ^^^^^^^^^^^^^^ Browse the references for one or more nodes from the server address spa...
Definition: open62541.h:5137
UA_UInt32 requestHandle
Definition: open62541.c:4753
float UA_Float
Float ^^^^^ An IEEE single precision (32 bit) floating point value.
Definition: open62541.h:995
#define UA_NS0ID_HASMODELPARENT
Definition: open62541.h:3066
UA_Boolean hasServerTimestamp
Definition: open62541.h:1571
Definition: open62541.c:4104
UA_UInt16 hour
Definition: open62541.h:1093
UA_NodeStoreEntry ** entries
Definition: open62541.c:19171
UA_UInt32 requestId
Definition: open62541.c:4742
UA_DateTime startTime
Definition: open62541.c:4211
UA_UInt32 sequenceNumber
Definition: open62541.h:3374
#define UA_STATUSCODE_BADNOTFOUND
Definition: open62541.h:717
UA_ResponseHeader responseHeader
Definition: open62541.h:4492
UA_LocalizedText description
Definition: open62541.h:3353
UA_Boolean hasValue
Definition: open62541.h:1568
UA_SecureChannel * UA_SecureChannelManager_get(UA_SecureChannelManager *cm, UA_UInt32 channelId)
Definition: open62541.c:18792
#define UA_STATUSCODE_BADSERVERNAMEMISSING
Definition: open62541.h:740
#define UA_STATUSCODE_BADDATAUNAVAILABLE
Definition: open62541.h:840
UA_UInt32 sendBufferSize
Definition: open62541.c:2551
void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request, UA_BrowseResponse *response)
Definition: open62541.c:22872
UA_Session * UA_SessionManager_getSession(UA_SessionManager *sm, const UA_NodeId *token)
Definition: open62541.c:18881
#define UA_NS0ID_XMLELEMENT
Definition: open62541.h:1811
void __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType, void *response, const UA_DataType *responseType)
Definition: open62541.c:25433
UA_StatusCode UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst, const UA_DataType *type) UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.c:7319
UA_String UA_DateTime_toString(UA_DateTime t)
Definition: open62541.c:4884
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER
Definition: open62541.h:2549
#define UA_NS0ID_SERVERDIAGNOSTICSTYPE
Definition: open62541.h:2490
#define UA_NS0ID_DELETEREFERENCESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2104
UA_UInt64 u64
Definition: open62541.c:779
#define ANONYMOUS_POLICY
Definition: open62541.c:4155
void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem)
#define UA_TYPES_BROWSENEXTREQUEST
Definition: open62541.h:4221
#define VERSION(MAJOR, MINOR, PATCH, LABEL)
Definition: open62541.c:27585
void UA_Log_Stdout(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args)
Definition: open62541.c:27532
UA_ResponseHeader responseHeader
Definition: open62541.h:4760
UA_MessageSecurityMode securityMode
Definition: open62541.c:3233
void UA_Connection_deleteMembers(UA_Connection *connection)
Definition: open62541.c:14867
UA_StatusCode UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname, const char **port, const char **path)
Definition: open62541.c:15021
void Service_CreateSubscription(UA_Server *server, UA_Session *session, const UA_CreateSubscriptionRequest *request, UA_CreateSubscriptionResponse *response)
Subscription Service Set Subscriptions are used to report Notifications to the Client.
UA_UInt32 subscriptionId
Definition: open62541.h:3995
#define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG,...)
Log Helper
Definition: open62541.c:3276
#define UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK
Definition: open62541.h:875
#define UA_STATUSCODE_BADSTRUCTUREMISSING
Definition: open62541.h:725
UA_StatusCode __UA_Client_writeAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, const void *in, const UA_DataType *inDataType)
Definition: open62541.c:25775
#define UA_NS0ID_HASEFFECT
Definition: open62541.h:1846
void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response)
MonitoredItem Service Set Clients define MonitoredItems to subscribe to data and Events.
UA_DeleteReferencesItem * referencesToDelete
Definition: open62541.h:4750
void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *request, UA_ReadResponse *response)
Query Service Set This Service Set is used to issue a Query to a Server.
Definition: open62541.c:20860
UA_Boolean discardOldest
Definition: open62541.h:3679
#define UA_TYPES_WRITEVALUE
Definition: open62541.h:3639
#define UA_SECURE_MESSAGE_HEADER_LENGTH
Definition: open62541.c:15161
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE
Definition: open62541.h:2550
ObjectTypeAttributes ^^^^^^^^^^^^^^^^^^^^ The attributes for an object type node. ...
Definition: open62541.h:3736
UA_ExtensionObject userIdentityToken
Definition: open62541.h:4074
UA_StatusCode UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
Definition: open62541.c:22497
UA_Boolean UA_String_equal(const UA_String *s1, const UA_String *s2)
Definition: open62541.c:4838
UserTokenPolicy ^^^^^^^^^^^^^^^ Describes a user token that can be used with a server.
Definition: open62541.h:4342
UA_ResponseHeader responseHeader
Definition: open62541.h:4697
UA_Boolean hasInnerDiagnosticInfo
Definition: open62541.h:1594
#define UA_STATUSCODE_BADENTRYEXISTS
Definition: open62541.h:841
#define CHECK_DATATYPE_SCALAR(EXP_DT)
Definition: open62541.c:20999
#define UA_STATUSCODE_BADVIEWVERSIONINVALID
Definition: open62541.h:772
struct UA_DelayedJob UA_DelayedJob
UA_StatusCode * results
Definition: open62541.h:4671
#define UA_NS0ID_HASSUBTYPE
Definition: open62541.h:1838
UA_BrowseResultMask
BrowseResultMask ^^^^^^^^^^^^^^^^ A bit mask which specifies what should be returned in a browse resp...
Definition: open62541.h:3279
#define UA_TYPES_USERTOKENTYPE
Definition: open62541.h:4061
UA_RequestHeader requestHeader
Definition: open62541.h:4465
#define UA_TYPES_ADDREFERENCESRESPONSE
Definition: open62541.h:4852
void(* deleteMembers)(UA_ServerNetworkLayer *nl)
Deletes the network content.
Definition: open62541.h:9799
UA_NodeId sessionId
Definition: open62541.c:3730
UA_StatusCode UA_Client_readArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, UA_UInt32 **outArrayDimensions, size_t *outArrayDimensionsSize)
Definition: open62541.c:25904
UA_ValueSource
VariableNode
Definition: open62541.c:3438
UA_UInt32 messageSize
Definition: open62541.c:2630
UA_NodeId viewId
Definition: open62541.h:3930
#define UA_TYPES_CLOSESESSIONREQUEST
Definition: open62541.h:4320
#define UA_TYPES_DELETESUBSCRIPTIONSRESPONSE
Definition: open62541.h:4651
UA_ClientState state
Definition: open62541.c:4733
UA_UInt16 year
Definition: open62541.h:1096
UA_UInt32 protocolVersion
Definition: open62541.h:9450
UA_UserTokenPolicy token
Definition: open62541.c:4751
UA_UInt32 subscriptionId
Definition: open62541.h:4454
UA_ResponseHeader responseHeader
Definition: open62541.h:4845
void Service_Call_single(UA_Server *server, UA_Session *session, const UA_CallMethodRequest *request, UA_CallMethodResult *result)
UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal)
Definition: open62541.c:18509
#define UA_NS0ID_ADDNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2086
void * UA_new(const UA_DataType *type)
The following functions are used for generic handling of data types.
Definition: open62541.c:5576
UA_UInt32 requestedMaxKeepAliveCount
Definition: open62541.h:4231
#define UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN
Definition: open62541.h:806
#define UA_STATUSCODE_BADSERVERURIINVALID
Definition: open62541.h:739
#define UA_NS0ID_DATAVALUE
Definition: open62541.h:1818
FindServersResponse ^^^^^^^^^^^^^^^^^^^ Finds the servers known to the discovery server.
Definition: open62541.h:4933
UA_StatusCode UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId, const UA_ValueCallback callback)
Definition: open62541.c:22527
#define UA_STATUSCODE_BADNODENOTINVIEW
Definition: open62541.h:738
UA_StatusCode __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId)
Definition: open62541.c:22035
size_t outputArgumentsSize
Definition: open62541.h:3449
CloseSessionResponse ^^^^^^^^^^^^^^^^^^^^ Closes a session with the server.
Definition: open62541.h:4896
#define UA_TYPES_FINDSERVERSREQUEST
Definition: open62541.h:4565
#define UA_NS0ID_TOSTATE
Definition: open62541.h:1844
UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running)
Definition: open62541.c:18614
#define MANUFACTURER_NAME
Definition: open62541.c:27575
UA_UInt32 maxResponseMessageSize
Definition: open62541.c:3732
UA_NodeId addedNodeId
Definition: open62541.h:3341
UA_DateTime serverTimestamp
Definition: open62541.h:1578
UA_NODE_BASEATTRIBUTES UA_Byte eventNotifier
Definition: open62541.c:3525
UA_String UA_XmlElement
XmlElement ^^^^^^^^^^ An XML element.
Definition: open62541.h:1154
NodeAttributes ^^^^^^^^^^^^^^ The base attributes for all nodes.
Definition: open62541.h:3955
NotificationMessage ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3373
UA_ExpandedNodeId parentNodeId
Definition: open62541.h:4814
#define UA_TYPES_REPUBLISHREQUEST
Definition: open62541.h:4458
#define SOCKET
Definition: open62541.c:26718
#define UA_STATUSCODE_BADSECURECHANNELIDINVALID
Definition: open62541.h:689
UA_UInt32 userWriteMask
Definition: open62541.h:3355
#define UA_USEC_TO_DATETIME
Definition: open62541.h:1073
#define UA_NS0ID_PROPERTYTYPE
Definition: open62541.h:1852
UA_UInt16 availableContinuationPoints
Definition: open62541.c:3736
void Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request, UA_CloseSessionResponse *response)
Definition: open62541.c:20036
#define UA_TYPES_BROWSEPATHRESULT
Definition: open62541.h:4269
#define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER
Definition: open62541.c:2657
#define UA_NS0ID_HASTYPEDEFINITION
Definition: open62541.h:1835
#define UA_MINMESSAGESIZE
Definition: open62541.c:24740
#define UA_PRINTF_STRING_DATA(STRING)
Definition: open62541.h:9732
#define UA_NS0ID_HIERARCHICALREFERENCES
Definition: open62541.h:1828
UA_BrowsePathTarget * targets
Definition: open62541.h:4266
Networking Client-server connection is represented by a UA_Connection structure.
Definition: open62541.h:9449
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO
Definition: open62541.h:2544
#define UA_NS0ID_TYPESFOLDER
Definition: open62541.h:1864
#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG
Definition: open62541.h:2571
UA_WriteValue * nodesToWrite
Definition: open62541.h:4413
#define UA_TYPES_DELETENODESITEM
Definition: open62541.h:3856
UA_DataValue UA_Server_read(UA_Server *server, const UA_ReadValueId *item, UA_TimestampsToReturn timestamps)
Reading and Writing Node Attributes The functions for reading and writing node attributes call the re...
Definition: open62541.c:20936
UA_NodeId startingNode
Definition: open62541.h:5015
#define UA_STATUSCODE_BADTOOMANYARGUMENTS
Definition: open62541.h:699
UA_UInt32 attributeId
Definition: open62541.h:3875
#define UA_NS0ID_CREATESUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2385
DataChangeFilter ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4872
UA_MonitoredItemCreateRequest * itemsToCreate
Definition: open62541.h:4950
UA_ClientConfig config
Definition: open62541.c:4734
#define UA_STATUSCODE_BADBOUNDNOTFOUND
Definition: open62541.h:837
MethodAttributes ^^^^^^^^^^^^^^^^ The attributes for a method node.
Definition: open62541.h:3602
UnregisterNodesRequest ^^^^^^^^^^^^^^^^^^^^^^ Unregisters one or more previously registered nodes...
Definition: open62541.h:3513
#define UA_NS0ID_BYTESTRING
Definition: open62541.h:1810
UA_NodeClass nodeClass
Definition: open62541.h:4577
#define UA_STATUSCODE_BADNOCOMMUNICATION
Definition: open62541.h:704
UA_ByteString byteString
Definition: open62541.h:1178
#define UA_TYPES_SERVERSTATUSDATATYPE
Definition: open62541.h:4838
#define UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID
Definition: open62541.h:697
#define UA_NS0ID_DOUBLE
Definition: open62541.h:1806
#define UA_TYPES_DATACHANGENOTIFICATION
Definition: open62541.h:4512
#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT
Definition: open62541.c:6633
#define UA_STRING_STATIC_NULL
Definition: open62541.c:27582
#define UA_STATUSCODE_BADINVALIDARGUMENT
Definition: open62541.h:866
void Service_SetMonitoringMode(UA_Server *server, UA_Session *session, const UA_SetMonitoringModeRequest *request, UA_SetMonitoringModeResponse *response)
void Service_FindServers(UA_Server *server, UA_Session *session, const UA_FindServersRequest *request, UA_FindServersResponse *response)
Discovery Service Set This Service Set defines Services used to discover the Endpoints implemented by...
Definition: open62541.c:19726
#define UA_STATUSCODE_GOODPOSTACTIONFAILED
Definition: open62541.h:856
#define UA_STATUSCODE_UNCERTAINSUBNORMAL
Definition: open62541.h:821
UA_StatusCode(* start)(UA_ServerNetworkLayer *nl, UA_Logger logger)
Definition: open62541.h:9774
#define UA_fd_isset(fd, fds)
Definition: open62541.c:26748
UA_NumericRangeDimension * dimensions
Definition: open62541.h:1348
UA_ResponseHeader responseHeader
Definition: open62541.h:4897
#define UA_STATUSCODE_GOODCOMMUNICATIONEVENT
Definition: open62541.h:862
const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7533
#define UA_NODESTORE_MINSIZE
Definition: open62541.c:19161
#define UA_NS0ID_NODEID
Definition: open62541.h:1812
UA_StatusCode statusCode
Definition: open62541.h:3444
#define UA_STATUSCODE_BADOBJECTDELETED
Definition: open62541.h:718
UA_Boolean hasNamespaceUri
Definition: open62541.h:1589
#define UA_STATUSCODE_BADTCPENDPOINTURLINVALID
Definition: open62541.h:802
UA_DateTime validTill
Definition: open62541.c:3734
union UA_ExtensionObject::@1 content
UA_StatusCode * results
Definition: open62541.h:4001
UA_SubscriptionState
Definition: open62541.c:3885
UA_ApplicationDescription server
Definition: open62541.h:5070
UA_NodeId nodeId
Definition: open62541.h:3633
#define UA_STATUSCODE_GOODSHUTDOWNEVENT
Definition: open62541.h:863
#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE
Definition: open62541.h:4866
#define UA_STATUSCODE_BADSECURITYMODEREJECTED
Definition: open62541.h:744
#define UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON
Definition: open62541.h:2634
UA_Boolean deleteTargetReferences
Definition: open62541.h:3853
UA_NodeId sourceNodeId
Definition: open62541.h:4615
#define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER
Definition: open62541.c:2597
TcpHelloMessage ^^^^^^^^^^^^^^^ Hello Message.
Definition: open62541.c:2548
#define UA_STATUSCODE_BADNODECLASSINVALID
Definition: open62541.h:756
UA_Subscription * UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID)
ChannelSecurityToken ^^^^^^^^^^^^^^^^^^^^ The token that identifies a set of keys for an active secur...
Definition: open62541.h:3827
UA_Client_Authentication authenticationMethod
Definition: open62541.c:4746
#define UA_TYPES_NODEATTRIBUTES
Definition: open62541.h:3963
#define UA_TYPES_MODIFYMONITOREDITEMSRESPONSE
Definition: open62541.h:4767
#define UA_TYPES_DEADBANDTYPE
Definition: open62541.h:3759
UA_UInt16 month
Definition: open62541.h:1095
Server Configuration The following structure is passed to a new server for configuration.
Definition: open62541.h:9806
#define UA_TYPES_REFERENCETYPEATTRIBUTES
Definition: open62541.h:4380
#define UA_STATUSCODE_BADCERTIFICATEREVOKED
Definition: open62541.h:683
#define UA_NS0ID_CREATEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2349
UA_UInt32 writeMask
Definition: open62541.h:3959
#define UA_STATUSCODE_BADNOMATCH
Definition: open62541.h:779
#define UA_STATUSCODE_GOODEDITED
Definition: open62541.h:855
UA_AttributeId
Standard-Defined Constants This section contains numerical and string constants that are defined in t...
Definition: open62541.h:577
#define TAILQ_FIRST(head)
Definition: open62541.c:450
UA_UInt32 data1
Definition: open62541.h:1108
#define UA_TYPES_CALLREQUEST
Definition: open62541.h:3596
ViewAttributes ^^^^^^^^^^^^^^ The attributes for a view node.
Definition: open62541.h:3263
#define UA_ASSERT_RCU_LOCKED()
Definition: open62541.c:4188
#define UA_NS0ID_UINT16
Definition: open62541.h:1800
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER
Definition: open62541.c:2668
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME
Definition: open62541.h:2545
UA_Boolean historizing
Definition: open62541.c:3466
UA_StatusCode status
Definition: open62541.c:781
enum UA_NodeIdType identifierType
Definition: open62541.h:1173
#define UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS
Definition: open62541.h:789
#define UA_STATUSCODE_BADSEMPAHOREFILEMISSING
Definition: open62541.h:742
UA_NodeId nodeId
Definition: open62541.h:3874
#define UA_STATUSCODE_BADDISCOVERYURLMISSING
Definition: open62541.h:741
UA_BrowseDescription * nodesToBrowse
Definition: open62541.h:5005
#define UA_NS0ID_MODELLINGRULE_MANDATORY
Definition: open62541.h:1858
DeleteNodesItem ^^^^^^^^^^^^^^^ A request to delete a node to the server address space.
Definition: open62541.h:3851
size_t referencesSize
Definition: open62541.h:5028
#define UA_NodeStore_newDataTypeNode()
Definition: open62541.c:3997
UA_CallMethodRequest * methodsToCall
Definition: open62541.h:3593
struct UA_NodeStoreEntry UA_NodeStoreEntry
UA_MessageSecurityMode securityMode
Definition: open62541.h:4292
UA_Boolean isInverse
Definition: open62541.h:3701
#define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3296
UA_MonitoredItemModifyRequest * itemsToModify
Definition: open62541.h:4533
int16_t UA_Int16
Int16 ^^^^^ An integer value between -32 768 and 32 767.
Definition: open62541.h:946
UA_StatusCode UA_EndpointUrl_split(const char *endpointUrl, char *hostname, UA_UInt16 *port, const char **path)
EndpointURL Helper ^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:15086
UA_Boolean includeSubtypes
Definition: open62541.h:4441
#define MAXTIMEOUT
There are four types of job execution:
Definition: open62541.c:17962
UA_UInt16 chunksSoFar
Definition: open62541.c:3226
#define UA_TRANSPORT_CHUNKTYPE
Definition: open62541.c:2647
UA_StatusCode UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences)
Definition: open62541.c:22411
#define UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME
Definition: open62541.h:2541
#define UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID
Definition: open62541.h:675
void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel)
Definition: open62541.c:19884
UA_NODE_BASEATTRIBUTES UA_NODE_VARIABLEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3484
QueryDataDescription ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5056
#define UA_OPEN62541_VER_MINOR
Definition: open62541.h:40
void * methodHandle
Definition: open62541.c:3511
UA_StatusCode UA_SecureChannelManager_init(UA_SecureChannelManager *cm, UA_Server *server)
Definition: open62541.c:18634
size_t elementsSize
Definition: open62541.h:4658
UA_UInt32 receiveBufferSize
Definition: open62541.c:2550
UA_NodeId authenticationToken
Definition: open62541.h:3301
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3673
UA_ResponseHeader responseHeader
Definition: open62541.h:4401
#define UA_TYPES_BYTE
Byte ^^^^.
Definition: open62541.h:3103
UA_LocalizedText displayName
Definition: open62541.h:4576
BrowseNextResponse ^^^^^^^^^^^^^^^^^^ Continues one or more browse operations.
Definition: open62541.h:5111
#define UA_NS0ID_BASEOBJECTTYPE
Definition: open62541.h:1848
DeleteReferencesItem ^^^^^^^^^^^^^^^^^^^^ A request to delete a node from the server address space...
Definition: open62541.h:3618
int32_t UA_Int32
Int32 ^^^^^ An integer value between -2 147 483 648 and 2 147 483 647.
Definition: open62541.h:962
void UA_Session_updateLifetime(UA_Session *session)
Definition: open62541.c:15676
#define UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED
Definition: open62541.h:857
MonitoredItemCreateResult ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3645
UA_StatusCode serviceResult
Definition: open62541.h:3904
#define UA_STATUSCODE_BADSECURECHANNELCLOSED
Definition: open62541.h:805
UA_ConnectionConfig localConf
Definition: open62541.h:9480
UA_DateTime UA_DateTime_nowMonotonic(void)
Definition: open62541.c:27483
UA_String encryptionAlgorithm
Definition: open62541.h:4027
UA_UInt16 namespaceIndex
Definition: open62541.h:1172
UA_ExpandedNodeId targetId
Definition: open62541.h:3702
const UA_String UA_STRING_NULL
Definition: open62541.c:4781
#define UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE
Definition: open62541.h:774
UA_ByteString * continuationPoints
Definition: open62541.h:4218
UA_UInt32 UA_UInt32_random(void)
Definition: open62541.c:4810
#define UA_TYPES_MONITORINGPARAMETERS
Definition: open62541.h:3682
UA_ExpandedNodeId nodeId
Definition: open62541.h:4574
ExpandedNodeId ^^^^^^^^^^^^^^ A NodeId that allows the namespace URI to be specified instead of an in...
Definition: open62541.h:1238
UA_UInt32 writeMask
Definition: open62541.h:4426
ParsingResult ^^^^^^^^^^^^^.
Definition: open62541.h:3459
UA_UInt16 addNamespace(UA_Server *server, const UA_String name)
Definition: open62541.c:15759
#define UA_PRINTF_GUID_FORMAT
Convenience macros for complex types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:9726
CallMethodRequest ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3500
void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session, const UA_DeleteSubscriptionsRequest *request, UA_DeleteSubscriptionsResponse *response)
UA_Boolean isAbstract
Definition: open62541.h:3892
UA_UInt32 maxNotificationsPerPublish
Definition: open62541.h:4232
UA_UInt32 sendBufferSize
Definition: open62541.h:9451
Definition: open62541.c:3209
#define UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED
Definition: open62541.h:808
#define UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN
Definition: open62541.h:792
#define UA_realloc(ptr, size)
Definition: open62541.h:105
ObjectNode
Definition: open62541.c:3523
#define WIN32_INT
Definition: open62541.c:26719
UA_RequestHeader requestHeader
Definition: open62541.h:4480
#define UA_NS0ID_STATUSCODE
Definition: open62541.h:1814
UA_ExpandedNodeId targetNodeId
Definition: open62541.h:4619
UA_ByteString serverCertificate
Definition: open62541.h:5157
ActivateSessionResponse ^^^^^^^^^^^^^^^^^^^^^^^ Activates a session with the server.
Definition: open62541.h:4144
VariableAttributes ^^^^^^^^^^^^^^^^^^ The attributes for a variable node.
Definition: open62541.h:3350
#define UA_STATUSCODE_BADSERVERINDEXINVALID
Definition: open62541.h:768
UA_IdType
IdType ^^^^^^ The type of identifier used in a node id.
Definition: open62541.h:4036
UA_StatusCode UA_Subscription_removeRetransmissionMessage(UA_Subscription *sub, UA_UInt32 sequenceNumber)
void UA_random_seed(UA_UInt64 seed)
Random Number Generator If UA_ENABLE_MULTITHREADING is defined, then the seed is stored in thread loc...
Definition: open62541.c:4805
UA_ResponseHeader responseHeader
Definition: open62541.h:4588
#define UA_STATUSCODE_BADREQUESTTYPEINVALID
Definition: open62541.h:743
#define UA_TYPES_SERVICEFAULT
Definition: open62541.h:4927
UA_DateTime currentTime
Definition: open62541.h:4831
#define UA_TYPES_APPLICATIONTYPE
Definition: open62541.h:4106
UA_StatusCode UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node)
Definition: open62541.c:19420
UA_Boolean deleteSubscriptions
Definition: open62541.h:4317
const char * LogLevelNames[6]
Definition: open62541.c:27522
UA_ChunkType
ChunkType ^^^^^^^^^ Type of the chunk.
Definition: open62541.c:2639
UA_UInt16 serverPicoseconds
Definition: open62541.h:1579
UA_ApplicationDescription clientDescription
Definition: open62541.c:3726
WriteResponse ^^^^^^^^^^^^^.
Definition: open62541.h:4200
SubscriptionAcknowledgement ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3862
void UA_Server_delete(UA_Server *server)
Definition: open62541.c:15878
UA_Double minimumSamplingInterval
Definition: open62541.h:3363
UA_StatusCode UA_Variant_setArrayCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type)
Definition: open62541.c:5198
#define UA_STATUSCODE_BADSYNTAXERROR
Definition: open62541.h:877
#define UA_TYPES_MONITOREDITEMNOTIFICATION
Definition: open62541.h:3845
#define UA_STATUSCODE_BADREFERENCENOTALLOWED
Definition: open62541.h:753
UA_CallMethodResult * results
Definition: open62541.h:4699
#define UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME
Definition: open62541.h:2542
UserIdentityToken ^^^^^^^^^^^^^^^^^ A base type for a user identity token.
Definition: open62541.h:3726
UA_Boolean isForward
Definition: open62541.h:4617
#define DOUBLE_NEG_INF
Definition: open62541.c:6209
UA_StatusCode(* send)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9504
UA_StatusCode UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_String targetServerUri, const UA_ExpandedNodeId targetNodeId, UA_NodeClass targetNodeClass)
Definition: open62541.c:25590
#define UA_NS0ID_ACTIVATESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2065
#define UA_TYPES_DATACHANGETRIGGER
Definition: open62541.h:3786
#define UA_STATUSCODE_BADSEQUENCENUMBERINVALID
Definition: open62541.h:807
QueryNextResponse ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4131
UA_NodeAttributesMask
NodeAttributesMask ^^^^^^^^^^^^^^^^^^ The bits used to specify default attributes for a new node...
Definition: open62541.h:3386
#define UA_TYPES_VARIABLEATTRIBUTES
Definition: open62541.h:3367
#define UA_NS0ID_DELETEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2379
UA_Boolean releaseContinuationPoints
Definition: open62541.h:4216
#define UA_TYPES_CALLMETHODREQUEST
Definition: open62541.h:3507
#define UA_NODEIDTYPE_NUMERIC_FOURBYTE
Definition: open62541.c:6455
#define UA_STATUSCODE_BADOUTOFMEMORY
Definition: open62541.h:654
UA_LocalizedText inverseName
Definition: open62541.c:3654
#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED
Definition: open62541.h:831
#define UA_NodeStore_newObjectNode()
Definition: open62541.c:3987
#define UA_TYPES_CHANNELSECURITYTOKEN
Definition: open62541.h:3834
UA_MethodCallback attachedMethod
Definition: open62541.c:3512
#define UA_TYPES_BOOLEAN
Boolean ^^^^^^^.
Definition: open62541.h:3091
#define UA_STATUSCODE_BADSESSIONNOTACTIVATED
Definition: open62541.h:694
#define UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY
Definition: open62541.h:701
#define SIMPLEQ_REMOVE_HEAD(head, field)
Definition: open62541.c:338
#define UA_NS0ID_SERVER_SERVERARRAY
Definition: open62541.h:2538
UA_ResponseHeader responseHeader
Definition: open62541.h:4711
#define UA_STATUSCODE_BADMAXCONNECTIONSREACHED
Definition: open62541.h:878
UA_MonitoredItem * UA_Subscription_getMonitoredItem(UA_Subscription *sub, UA_UInt32 monitoredItemID)
#define UA_TYPES_BROWSEDESCRIPTION
Definition: open62541.h:4446
#define UA_TYPES_CONTENTFILTERELEMENTRESULT
Definition: open62541.h:3533
#define UA_STATUSCODE_BADBOUNDNOTSUPPORTED
Definition: open62541.h:838
#define UA_TYPES_REFERENCENODE
Definition: open62541.h:3705
UA_UInt32 userWriteMask
Definition: open62541.h:4427
#define UA_NODEIDTYPE_NUMERIC_COMPLETE
Definition: open62541.c:6456
#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN
Definition: open62541.h:682
void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server)
#define UA_STATUSCODE_BADSERVICEUNSUPPORTED
Definition: open62541.h:664
UA_UInt32 maxNotificationsPerPublish
Definition: open62541.h:4332
Guid ^^^^ A 16 byte value that can be used as a globally unique identifier.
Definition: open62541.h:1107
UA_MessageSecurityMode
MessageSecurityMode ^^^^^^^^^^^^^^^^^^^ The type of security to use on a message. ...
Definition: open62541.h:3659
UA_UInt16 microSec
Definition: open62541.h:1089
UA_StatusCode UA_Node_copyAnyNodeClass(const UA_Node *src, UA_Node *dst)
Definition: open62541.c:19084
UA_Boolean hasSymbolicId
Definition: open62541.h:1588
String ^^^^^^ A sequence of Unicode characters.
Definition: open62541.h:1038
#define UA_STATUSCODE_BADRESOURCEUNAVAILABLE
Definition: open62541.h:655
const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19436
MonitoringParameters ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3674
#define SIMPLEQ_HEAD(name, type)
Definition: open62541.c:280
UA_DeadbandType
DeadbandType ^^^^^^^^^^^^.
Definition: open62541.h:3751
UA_Int32 valueRank
Definition: open62541.h:3714
UA_ResponseHeader responseHeader
Definition: open62541.h:5138
#define UA_TYPES_MONITOREDITEMMODIFYRESULT
Definition: open62541.h:3323
#define UA_assert(ignore)
Definition: open62541.c:744
#define UA_NS0ID_DELETESUBSCRIPTIONSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2439
#define SIMPLEQ_INIT(head)
Definition: open62541.c:315
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER
Definition: open62541.c:2542
void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel)
Definition: open62541.c:15014
type_equivalence
Definition: open62541.c:20066
UA_StatusCode UA_Server_setObjectTypeNode_lifecycleManagement(UA_Server *server, UA_NodeId nodeId, UA_ObjectLifecycleManagement olm)
Definition: open62541.c:22576
UA_NodeId authenticationToken
Definition: open62541.c:3729
#define UA_TYPES_VIEWATTRIBUTES
Definition: open62541.h:3273
#define UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS
Definition: open62541.h:790
UA_RequestHeader requestHeader
Definition: open62541.h:5039
size_t(* stop)(UA_ServerNetworkLayer *nl, UA_Job **jobs)
Definition: open62541.h:9796
UA_UInt32 receiveSequenceNumber
Definition: open62541.c:3240
#define UA_STATUSCODE_BADNODELETERIGHTS
Definition: open62541.h:766
#define UA_STATUSCODE_BADPARENTNODEIDINVALID
Definition: open62541.h:752
UA_String discoveryUrl
Definition: open62541.h:9767
DeleteMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4356
#define UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE
Definition: open62541.h:828
UA_StatusCode UA_Connection_completeMessages(UA_Connection *connection, UA_ByteString *message, UA_Boolean *realloced)
Definition: open62541.c:14872
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS
Definition: open62541.h:2637
#define UA_STATUSCODE_BADNONCEINVALID
Definition: open62541.h:691
UA_Boolean UA_NodeId_isNull(const UA_NodeId *p)
Definition: open62541.c:4990
UA_StatusCode statusCode
Definition: open62541.h:3340
void UA_Node_deleteMembersAnyNodeClass(UA_Node *node)
Definition: open62541.c:18953
#define UA_TYPES_LOCALIZEDTEXT
LocalizedText ^^^^^^^^^^^^^.
Definition: open62541.h:3211
AddReferencesResponse ^^^^^^^^^^^^^^^^^^^^^ Adds one or more references to the server address space...
Definition: open62541.h:4844
const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard
Definition: open62541.c:27592
UA_Byte membersSize
Definition: open62541.h:1657
UA_Boolean hasStatus
Definition: open62541.h:1569
UA_StatusCode(* UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle)
Definition: open62541.h:10250
UA_Boolean userExecutable
Definition: open62541.h:3609
UA_Double requestedPublishingInterval
Definition: open62541.h:4329
#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST
Definition: open62541.h:5131
UA_ConnectionConfig remoteConf
Definition: open62541.h:9481
UA_BrowseResult UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint, const UA_ByteString *continuationPoint)
Definition: open62541.c:22948
const UA_Node * getNodeType(UA_Server *server, const UA_Node *node)
Definition: open62541.c:17827
#define UA_TYPES_RESPONSEHEADER
Definition: open62541.h:3911
UA_StatusCode UA_Server_run_shutdown(UA_Server *server)
Definition: open62541.c:18578
#define UA_STATUSCODE_BADIDENTITYTOKENREJECTED
Definition: open62541.h:688
#define UA_NODE_VARIABLEATTRIBUTES
Definition: open62541.c:3443
#define UA_STATUSCODE_BADSESSIONCLOSED
Definition: open62541.h:693
UA_ResponseHeader responseHeader
Definition: open62541.h:4669
#define DOUBLE_NAN
Definition: open62541.c:6207
#define UA_STATUSCODE_GOOD
Definition: open62541.h:651
UA_String locale
Definition: open62541.h:1314
#define UA_STATUSCODE_BADNOTTYPEDEFINITION
Definition: open62541.h:775
#define UA_STATUSCODE_BADNOTHINGTODO
Definition: open62541.h:668
Definition: open62541.c:19163
#define UA_NS0ID_REGISTERNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2158
UA_Guid guid
Definition: open62541.h:1177
#define UA_STATUSCODE_GOODCLAMPED
Definition: open62541.h:703
UA_NodeId nodeId
Definition: open62541.h:1239
UA_EXPORT const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT]
Definition: open62541.c:14688
struct UA_SecureChannelManager UA_SecureChannelManager
UA_ExpandedNodeId requestedNewNodeId
Definition: open62541.h:4816
#define UA_STATUSCODE_BADNOTREADABLE
Definition: open62541.h:713
UA_StatusCode UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type)
Definition: open62541.c:5173
#define UA_RCU_LOCK()
Definition: open62541.c:4186
void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session)
Definition: open62541.c:15233
#define UA_TYPES_UNREGISTERNODESRESPONSE
Definition: open62541.h:4404
void Service_ModifySubscription(UA_Server *server, UA_Session *session, const UA_ModifySubscriptionRequest *request, UA_ModifySubscriptionResponse *response)
#define WOULDBLOCK
Definition: open62541.c:26766
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS
Definition: open62541.h:2613
UA_StatusCode typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId, UA_Int32 targetValueRank, size_t targetArrayDimensionsSize, const UA_UInt32 *targetArrayDimensions, const UA_Variant *value, const UA_NumericRange *range, UA_Variant *editableValue)
Definition: open62541.c:20194
#define UA_NS0ID_ROOTFOLDER
Definition: open62541.h:1862
UA_ResponseHeader responseHeader
Definition: open62541.h:3942
UA_StatusCode UA_Client_getEndpoints(UA_Client *client, const char *serverUrl, size_t *endpointDescriptionsSize, UA_EndpointDescription **endpointDescriptions)
Definition: open62541.c:25228
int8_t UA_SByte
SByte ^^^^^ An integer value between -128 and 127.
Definition: open62541.h:930
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY
Definition: open62541.h:2554
UA_Boolean UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2)
Definition: open62541.c:5015
#define UA_TYPES_FILTEROPERATOR
Definition: open62541.h:4182
#define UA_TYPES_CLOSESECURECHANNELREQUEST
Definition: open62541.h:3333
#define UA_NS0ID_SETMONITORINGMODEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2367
CloseSessionRequest ^^^^^^^^^^^^^^^^^^^ Closes a session with the server.
Definition: open62541.h:4315
#define UA_STATUSCODE_BADCERTIFICATETIMEINVALID
Definition: open62541.h:674
ReadResponse ^^^^^^^^^^^^.
Definition: open62541.h:4773
#define UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED
Definition: open62541.h:700
UA_BrowseDirection
BrowseDirection ^^^^^^^^^^^^^^^ The directions of the references to return.
Definition: open62541.h:3486
#define UA_NS0ID_DATETIME
Definition: open62541.h:1808
WriteRequest ^^^^^^^^^^^^.
Definition: open62541.h:4410
const UA_StatusCodeDescription * UA_StatusCode_description(UA_StatusCode code)
Definition: open62541.c:26672
UA_StatusCode MonitoredItem_unregisterSampleJob(UA_Server *server, UA_MonitoredItem *mon)
#define UA_TYPES_VIEWDESCRIPTION
Definition: open62541.h:3935
UA_ConnectionConfig conf
Definition: open62541.c:26946
void UA_NodeStore_delete(UA_NodeStore *ns)
Definition: open62541.c:19352
#define UA_TYPES_QUERYFIRSTREQUEST
Definition: open62541.h:5182
#define UA_NS0ID_SERVER_SERVERSTATUS
Definition: open62541.h:2540
#define UA_NS0ID_STRUCTURE
Definition: open62541.h:1817
UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range)
Definition: open62541.c:17672
UA_Boolean isArray
Definition: open62541.h:1647
#define UA_STATUSCODE_BADUSERACCESSDENIED
Definition: open62541.h:686
#define UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE
Definition: open62541.h:773
#define UA_NS0ID_SETPUBLISHINGMODEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2397
UA_StatusCode writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank, UA_Int32 constraintValueRank)
Definition: open62541.c:20333
void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response)
NodeManagement Service Set This Service Set defines Services to add and delete AddressSpace Nodes and...
Definition: open62541.c:22010
UA_StatusCode __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, UA_NodeId *outNewNodeId)
Definition: open62541.c:25680
#define UA_UINT32_MAX
Definition: open62541.h:972
#define UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED
Definition: open62541.h:712
ActivateSessionRequest ^^^^^^^^^^^^^^^^^^^^^^ Activates a session with the server.
Definition: open62541.h:4067
UA_NodeClass nodeClass
Definition: open62541.h:4818
#define FLOAT_NEG_INF
Definition: open62541.c:6174
#define UA_STATUSCODE_BADCONNECTIONCLOSED
Definition: open62541.h:869
UA_SecureChannel * channel
Definition: open62541.c:3223
UA_Byte * data
Definition: open62541.h:1040
UA_StatusCode UA_SecureChannel_sendBinaryMessage(UA_SecureChannel *channel, UA_UInt32 requestId, const void *content, const UA_DataType *contentType)
Definition: open62541.c:15344
#define UA_STATUSCODE_GOODENTRYINSERTED
Definition: open62541.h:844
#define UA_STATUSCODE_BADCOMMUNICATIONERROR
Definition: open62541.h:656
#define UA_TYPES_STATUSCODE
StatusCode ^^^^^^^^^^.
Definition: open62541.h:3199
ResponseHeader ^^^^^^^^^^^^^^ The header passed with every server response.
Definition: open62541.h:3901
void UA_SessionManager_deleteMembers(UA_SessionManager *sm)
Definition: open62541.c:18828
size_t(* UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype)
Definition: open62541.c:5870
void * data
Definition: open62541.h:1403
#define UA_TYPES_BROWSEDIRECTION
Definition: open62541.h:3494
void * instanceHandle
Definition: open62541.c:3528
CloseSecureChannelRequest ^^^^^^^^^^^^^^^^^^^^^^^^^ Closes a secure channel.
Definition: open62541.h:3329
#define UA_STATUSCODE_BADREQUESTHEADERINVALID
Definition: open62541.h:696
#define UA_TYPES_REGISTERNODESREQUEST
Definition: open62541.h:3975
#define UA_TYPES_EXTENSIONOBJECT
ExtensionObject ^^^^^^^^^^^^^^^.
Definition: open62541.h:3217
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES
Definition: open62541.h:2636
#define UA_TYPES_UNREGISTERNODESREQUEST
Definition: open62541.h:3519
#define PCG32_INITIALIZER
Definition: open62541.c:716
UA_SessionManager sessionManager
Definition: open62541.c:4217
UA_ResponseHeader responseHeader
Definition: open62541.h:4543
UA_UInt32 requestedMaxKeepAliveCount
Definition: open62541.h:4331
SetMonitoringModeResponse ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4542
#define UA_TYPES_BROWSERESULT
Definition: open62541.h:5032
ServerStatusDataType ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4829
UA_ByteString serverNonce
Definition: open62541.c:3239
void(* releaseSendBuffer)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9496
UA_UInt32 count
Definition: open62541.c:19173
UA_Connection * closeConnection
Definition: open62541.h:9587
#define LIST_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:224
void Service_DeleteReferences(UA_Server *server, UA_Session *session, const UA_DeleteReferencesRequest *request, UA_DeleteReferencesResponse *response)
Definition: open62541.c:22474
UA_UInt32 UA_NodeId_hash(const UA_NodeId *n)
Definition: open62541.c:5051
void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request, UA_GetEndpointsResponse *response)
Definition: open62541.c:19764
UA_NodeId referenceTypeId
Definition: open62541.h:4815
UA_StatusCode UA_Variant_setRange(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_NumericRange range)
Definition: open62541.c:5494
size_t methodsToCallSize
Definition: open62541.h:3592
UA_NodeId typeId
Definition: open62541.h:1654
#define UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT
Definition: open62541.h:781
BrowsePath ^^^^^^^^^^ A request to translate a path into a node id.
Definition: open62541.h:5014
#define UA_TYPES_QUERYNEXTRESPONSE
Definition: open62541.h:4138
DeleteSubscriptionsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4643
RelativePathElement ^^^^^^^^^^^^^^^^^^^ An element in a relative path.
Definition: open62541.h:3473
#define UA_STATUSCODE_BADSECURITYCHECKSFAILED
Definition: open62541.h:673
UA_LocalizedText displayName
Definition: open62541.h:3957
UA_NotificationMessage notificationMessage
Definition: open62541.h:3999
UA_FilterOperator
FilterOperator ^^^^^^^^^^^^^^.
Definition: open62541.h:4159
#define UA_STATUSCODE_BADCONDITIONNOTSHELVED
Definition: open62541.h:834
#define UA_TYPES_MONITOREDITEMCREATERESULT
Definition: open62541.h:3653
UA_String string
Definition: open62541.h:1176
#define UA_calloc(num, size)
Definition: open62541.h:104
uint8_t UA_Byte
Byte ^^^^ An integer value between 0 and 255.
Definition: open62541.h:938
BrowseResult ^^^^^^^^^^^^ The result of a browse operation.
Definition: open62541.h:5025
UA_DateTimeStruct UA_DateTime_toStruct(UA_DateTime t)
Definition: open62541.c:4853
void UA_Session_init(UA_Session *session)
Definition: open62541.c:15626
#define UA_STATUSCODE_BADMETHODINVALID
Definition: open62541.h:787
SecureConversationMessageHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Layer Sequence Header...
Definition: open62541.c:2663
#define UA_STATUSCODE_BADSENSORFAILURE
Definition: open62541.h:812
#define FLOAT_NAN
Definition: open62541.c:6172
#define UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN
Definition: open62541.h:681
void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel)
Definition: open62541.c:15170
UA_String name
Definition: open62541.h:3712
#define UA_BYTE_MAX
Definition: open62541.h:940
size_t nodesToBrowseSize
Definition: open62541.h:5004
UA_String indexRange
Definition: open62541.h:3876
#define UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH
Definition: open62541.h:730
#define UA_NS0ID_HASNOTIFIER
Definition: open62541.h:1841
#define UA_TYPES_DELETEREFERENCESREQUEST
Definition: open62541.h:4753
UA_QualifiedName dataEncoding
Definition: open62541.h:3877
UA_Boolean namespaceZero
Definition: open62541.h:1642
#define UA_STATUSCODE_BADAGGREGATENOTSUPPORTED
Definition: open62541.h:850
UA_UInt32 maxChunkCount
Definition: open62541.c:2553
#define DAYS_PER_4Y
Definition: open62541.c:26306
VariableTypeAttributes ^^^^^^^^^^^^^^^^^^^^^^ The attributes for a variable type node.
Definition: open62541.h:4243
UA_Boolean hasInnerStatusCode
Definition: open62541.h:1593
#define UA_TYPES_NOTIFICATIONMESSAGE
Definition: open62541.h:3380
UA_String namespaceUri
Definition: open62541.h:1240
#define UA_TYPES_TIMESTAMPSTORETURN
Definition: open62541.h:3584
UA_ReferenceDescription * references
Definition: open62541.h:5029
#define UA_STATUSCODE_BADNOSUBSCRIPTION
Definition: open62541.h:791
UA_StatusCode(* getSendBuffer)(UA_Connection *connection, size_t length, UA_ByteString *buf)
Definition: open62541.h:9492
CloseSecureChannelResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^ Closes a secure channel.
Definition: open62541.h:4518
Definition: open62541.c:3879
#define UA_TYPES_SECURITYTOKENREQUESTTYPE
Definition: open62541.h:3772
UA_AddNodesResult * results
Definition: open62541.h:4494
#define UA_NS0ID_UINT32
Definition: open62541.h:1802
#define DAYS_PER_100Y
Definition: open62541.c:26305
#define PRODUCT_NAME
Definition: open62541.c:27576
#define UA_STATUSCODE_BADUNEXPECTEDERROR
Definition: open62541.h:652
UA_StatusCode status
Definition: open62541.h:1575
#define UA_TYPES_DELETESUBSCRIPTIONSREQUEST
Definition: open62541.h:3923
#define UA_STATUSCODE_BADWRITENOTSUPPORTED
Definition: open62541.h:785
#define UA_NS0ID_GUID
Definition: open62541.h:1809
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES
Definition: open62541.h:2657
UA_Boolean hasAdditionalInfo
Definition: open62541.h:1592
UA_ByteString clientNonce
Definition: open62541.h:5044
UA_UInt32 sizePrimeIndex
Definition: open62541.c:19174
ViewNode
Definition: open62541.c:3685
#define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG
Definition: open62541.c:6459
#define UA_NS0ID_BUILDINFOTYPE
Definition: open62541.h:2646
UA_ResponseHeader responseHeader
Definition: open62541.h:4683
#define UA_STATUSCODE_BADWAITINGFORRESPONSE
Definition: open62541.h:873
UA_NODE_BASEATTRIBUTES UA_Byte eventNotifier
Definition: open62541.c:3687
UA_Boolean hasLocale
Definition: open62541.h:1591
#define UA_TYPES_ANONYMOUSIDENTITYTOKEN
Definition: open62541.h:3556
void UA_delete(void *p, const UA_DataType *type)
Definition: open62541.c:5752
UA_ServerState
ServerState ^^^^^^^^^^^.
Definition: open62541.h:4112
UA_UInt32 * availableSequenceNumbers
Definition: open62541.h:3997
#define UA_STATUSCODE_BADUNKNOWNRESPONSE
Definition: open62541.h:662
void UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_NodeId *sessionToken)
GetEndpointsRequest ^^^^^^^^^^^^^^^^^^^ Gets the endpoints used by the server.
Definition: open62541.h:4464
void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response)
Definition: open62541.c:22305
#define UA_NS0ID_HASHISTORICALCONFIGURATION
Definition: open62541.h:1847
UA_StatusCode(* UA_copySignature)(const void *src, void *dst, const UA_DataType *type)
Definition: open62541.c:5612
void pcg32_srandom_r(pcg32_random_t *rng, uint64_t initial_state, uint64_t initseq)
Definition: open62541.c:26406
UA_ExpandedNodeId targetNodeId
Definition: open62541.h:3622
UA_Boolean hasServerPicoseconds
Definition: open62541.h:1573
#define SLIST_INIT(head)
Definition: open62541.c:158
#define UA_TYPES_RELATIVEPATHELEMENT
Definition: open62541.h:3480
UA_ExtensionObject * notificationData
Definition: open62541.h:3377
AddNodesResult ^^^^^^^^^^^^^^ A result of an add node operation.
Definition: open62541.h:3339
#define UA_TYPES_DOUBLE
Double ^^^^^^.
Definition: open62541.h:3151
#define LIST_INSERT_AFTER(listelm, elm, field)
Definition: open62541.c:236
void(* releaseRecvBuffer)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9520
UA_String securityPolicyUri
Definition: open62541.h:5073
UA_ServerNetworkLayer UA_ServerNetworkLayerTCP(UA_ConnectionConfig conf, UA_UInt16 port)
Definition: open62541.c:27271
#define UA_STATUSCODE_BADCONTENTFILTERINVALID
Definition: open62541.h:727
CreateSessionResponse ^^^^^^^^^^^^^^^^^^^^^ Creates a new session with the server.
Definition: open62541.h:5151
UA_String text
Definition: open62541.h:1315
const UA_ByteString UA_BYTESTRING_NULL
Definition: open62541.c:4782
#define UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED
Definition: open62541.h:729
#define UA_TYPES_BROWSENEXTRESPONSE
Definition: open62541.h:5119
UA_NodeClass
NodeClass ^^^^^^^^^ A mask specifying the class of the node.
Definition: open62541.h:3807
UA_StatusCode UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_Connection *conn, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
Definition: open62541.c:18757
UA_UInt32 remainingPathIndex
Definition: open62541.h:3254
UA_StatusCode UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range)
Definition: open62541.c:5322
#define UA_TYPES_INT64
Int64 ^^^^^.
Definition: open62541.h:3133
#define UA_NS0ID_AGGREGATES
Definition: open62541.h:1837
#define UA_STATUSCODE_BADSOURCENODEIDINVALID
Definition: open62541.h:761
UA_TimestampsToReturn
TimestampsToReturn ^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3575
#define UA_NS0ID_EVENTTYPESFOLDER
Definition: open62541.h:2645
UA_StatusCode UA_Server_addRepeatedJob(UA_Server *server, UA_Job job, UA_UInt32 interval, UA_Guid *jobId)
Repeated jobs
Definition: open62541.c:18110
RegisterNodesRequest ^^^^^^^^^^^^^^^^^^^^ Registers one or more nodes for repeated use within a sessi...
Definition: open62541.h:3969
EndpointDescription ^^^^^^^^^^^^^^^^^^^ The description of a endpoint that can be used to access a se...
Definition: open62541.h:5068
#define LIST_EMPTY(head)
Definition: open62541.c:216
#define UA_BINARY_OVERLAYABLE_FLOAT
Float Endianness ^^^^^^^^^^^^^^^^ The definition UA_BINARY_OVERLAYABLE_FLOAT is true when the floatin...
Definition: open62541.h:268
UA_LocalizedText description
Definition: open62541.h:4425
ObjectAttributes ^^^^^^^^^^^^^^^^ The attributes for an object node.
Definition: open62541.h:4422
#define UA_NS0ID_SERVER_SERVICELEVEL
Definition: open62541.h:2551
#define UA_TYPES_QUERYNEXTREQUEST
Definition: open62541.h:4194
#define UA_STATUSCODE_BADTCPSERVERTOOBUSY
Definition: open62541.h:796
#define UA_TYPES_ACTIVATESESSIONRESPONSE
Definition: open62541.h:4153
#define UA_TYPES_REQUESTHEADER
Definition: open62541.h:3310
UA_DataTypeMember * members
Definition: open62541.h:1666
UA_ResponseHeader responseHeader
Definition: open62541.h:4725
#define UA_TYPES_UINT16
UInt16 ^^^^^^.
Definition: open62541.h:3115
UA_SecureChannel * channel
Definition: open62541.c:3735
UA_StatusCode UA_encodeBinary(const void *src, const UA_DataType *type, UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle, UA_ByteString *dst, size_t *offset) UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.c:7245
#define UA_TYPES_VARIANT
Variant ^^^^^^^.
Definition: open62541.h:3229
void UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm, UA_DateTime nowMonotonic)
Definition: open62541.c:18679
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4948
DeleteReferencesResponse ^^^^^^^^^^^^^^^^^^^^^^^^ Delete one or more references from the server addre...
Definition: open62541.h:4668
#define UA_TYPES_NODECLASS
Definition: open62541.h:3821
#define LIST_INIT(head)
Definition: open62541.c:232
#define UA_STATUSCODE_GOODOVERLOAD
Definition: open62541.h:702
void(* close)(UA_Connection *connection)
Definition: open62541.h:9523
UA_UInt32 requestHandle
Definition: open62541.h:3903
#define UA_FALSE
Definition: open62541.h:924
UA_NODE_BASEATTRIBUTES UA_Boolean executable
Definition: open62541.c:3507
void UA_Variant_setArray(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_DataType *type)
Definition: open62541.c:5189
#define UA_STATUSCODE_BADVIEWTIMESTAMPINVALID
Definition: open62541.h:770
void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response)
Session Service Set This Service Set defines Services for an application layer connection establishme...
Definition: open62541.c:19896
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY
Definition: open62541.h:2553
size_t availableSequenceNumbersSize
Definition: open62541.h:3996
#define UA_STATUSCODE_BADIDENTITYTOKENINVALID
Definition: open62541.h:687
#define PRODUCT_URI
Definition: open62541.c:27577
#define UA_fd_set(fd, fds)
Definition: open62541.c:26747
#define UA_alloca(SIZE)
Definition: open62541.h:113
UA_String name
Definition: open62541.h:1289
#define UA_NS0ID_SERVER_SERVERCAPABILITIES
Definition: open62541.h:2552
struct UA_NotificationMessageEntry UA_NotificationMessageEntry
#define AGAIN
Definition: open62541.c:26767
#define UA_STATUSCODE_BADBROWSEDIRECTIONINVALID
Definition: open62541.h:737
#define UA_STRING_STATIC(s)
Definition: open62541.c:27581
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:466
#define UA_STATUSCODE_GOODLOCALOVERRIDE
Definition: open62541.h:822
UA_Byte u8
Definition: open62541.c:773
#define SLIST_HEAD(name, type)
Definition: open62541.c:119
#define UA_TYPES_SERVERSTATE
Definition: open62541.h:4125
#define LIST_INSERT_HEAD(head, elm, field)
Definition: open62541.c:251
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY
Definition: open62541.c:2530
MonitoredItemCreateRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4735
void(* UA_Logger)(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args)
The signature of the logger.
Definition: open62541.h:9654
ModifyMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4759
UA_SecurityTokenRequestType
SecurityTokenRequestType ^^^^^^^^^^^^^^^^^^^^^^^^ Indicates whether a token if being created or renew...
Definition: open62541.h:3765
#define UA_NS0ID_HASEVENTSOURCE
Definition: open62541.h:1831
#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS
Definition: open62541.h:2556
#define UA_STATUSCODE_BADSECURITYPOLICYREJECTED
Definition: open62541.h:745
UA_STATIC_ASSERT(sizeof(UA_MessageType)==sizeof(UA_Int32), enum_must_be_32bit)
#define UA_NS0ID_CLOSESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2071
#define UA_STATUSCODE_BADINVALIDSTATE
Definition: open62541.h:870
size_t messageSizeSoFar
Definition: open62541.c:3227
#define UA_STATUSCODE_BADCONDITIONALREADYENABLED
Definition: open62541.h:825
#define UA_NS0ID_DIAGNOSTICINFO
Definition: open62541.h:1820
#define UA_NS0ID_SERVER_GETMONITOREDITEMS
Definition: open62541.h:2769
#define UA_STATUSCODE_BADFILTERLITERALINVALID
Definition: open62541.h:733
#define UA_STATUSCODE_BADARGUMENTSMISSING
Definition: open62541.h:788
#define UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE
Definition: open62541.h:817
UA_Double maxAge
Definition: open62541.h:4801
#define UA_STATUSCODE_BADNODATAAVAILABLE
Definition: open62541.h:872
#define UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED
Definition: open62541.h:860
UA_StatusCode Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node, const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, const UA_NodeId *typeDefinition, UA_InstantiationCallback *instantiationCallback, UA_NodeId *addedNodeId)
Definition: open62541.c:21663
UA_NodeId referenceTypeId
Definition: open62541.h:4440
UA_UInt32 * arrayDimensions
Definition: open62541.h:3360
#define UA_TYPES_OBJECTTYPEATTRIBUTES
Definition: open62541.h:3745
UA_StatusCode UA_Array_copy(const void *src, size_t size, void **dst, const UA_DataType *type)
Definition: open62541.c:5769
#define UA_STATUSCODE_BADATTRIBUTEIDINVALID
Definition: open62541.h:708
UA_Double samplingInterval
Definition: open62541.h:3676
UA_MonitoringMode monitoringMode
Definition: open62541.h:4389
#define UA_THREAD_LOCAL
Definition: open62541.c:766
#define UA_TYPES_CREATESESSIONREQUEST
Definition: open62541.h:5050
ContentFilterElementResult ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3525
#define UA_TYPES_BROWSEPATHTARGET
Definition: open62541.h:3257
UA_UInt32 attributeId
Definition: open62541.h:3634
#define UA_TYPES_NODETYPEDESCRIPTION
Definition: open62541.h:5105
#define UA_DATETIME_UNIX_EPOCH
Definition: open62541.h:1078
UA_UInt32 messageTypeAndChunkType
Definition: open62541.c:2629
#define UA_STATUSCODE_BADINVALIDTIMESTAMP
Definition: open62541.h:690
#define LIST_FOREACH(var, head, field)
Definition: open62541.c:219
void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest *request, UA_WriteResponse *response)
Definition: open62541.c:21145
#define UA_TYPES_OBJECTATTRIBUTES
Definition: open62541.h:4431
BrowseDescription ^^^^^^^^^^^^^^^^^ A request to browse the the references from a node...
Definition: open62541.h:4437
#define UA_NS0ID_BASEVARIABLETYPE
Definition: open62541.h:1850
#define UA_NodeStore_newMethodNode()
Definition: open62541.c:3989
#define UA_STATUSCODE_BADCERTIFICATEURIINVALID
Definition: open62541.h:677
#define UA_NS0ID_MODELLINGRULETYPE
Definition: open62541.h:1857
#define UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN
Definition: open62541.h:798
#define UA_NS0ID_SERVERSTATUSTYPE
Definition: open62541.h:2527
UA_StatusCode UA_Client_deleteNode(UA_Client *client, const UA_NodeId nodeId, UA_Boolean deleteTargetReferences)
Definition: open62541.c:25654
#define UA_NS0ID_READREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2229
#define UA_NS0ID_EXPANDEDNODEID
Definition: open62541.h:1813
struct session_list_entry session_list_entry
#define UA_RESTRICT
Non-aliasing pointers
Definition: open62541.h:163
#define UA_STATUSCODE_BADFILTEROPERATORINVALID
Definition: open62541.h:728
#define UA_TYPES_QUERYDATADESCRIPTION
Definition: open62541.h:5062
void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session, const UA_ModifyMonitoredItemsRequest *request, UA_ModifyMonitoredItemsResponse *response)
int __secs_to_tm(long long t, struct tm *tm)
Definition: open62541.c:26308
#define UA_NS0ID_BYTE
Definition: open62541.h:1798
UA_StatusCode UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
Definition: open62541.c:25623
#define UA_STATUSCODE_BADCONFIGURATIONERROR
Definition: open62541.h:809
#define UA_STATUSCODE_BADTOOMANYMONITOREDITEMS
Definition: open62541.h:670
status(* UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type)
Definition: open62541.c:5864
void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request, UA_RegisterNodesResponse *response)
Definition: open62541.c:23283
UA_UInt16 binaryEncodingId
Definition: open62541.h:1664
size_t arrayDimensionsSize
Definition: open62541.h:1404
UA_Boolean userExecutable
Definition: open62541.c:3508
UA_SubscriptionAcknowledgement * subscriptionAcknowledgements
Definition: open62541.h:4482
void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request, UA_RepublishResponse *response)
UA_String targetServerUri
Definition: open62541.h:4618
UA_Int32 localizedText
Definition: open62541.h:1597
UA_BrowseResult * results
Definition: open62541.h:5140
#define UA_NS0ID_MODELLINGRULE_OPTIONAL
Definition: open62541.h:1860
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4802
#define UA_NS0ID_HASCHILD
Definition: open62541.h:1829
union UA_NodeId::@0 identifier
#define UA_NS0ID_OBJECTTYPESFOLDER
Definition: open62541.h:1866
#define UA_TYPES_DATETIME
DateTime ^^^^^^^^.
Definition: open62541.h:3163
UA_ReadValueId itemToMonitor
Definition: open62541.h:4736
UA_ResponseHeader responseHeader
Definition: open62541.h:4774
UA_Client * UA_Client_new(UA_ClientConfig config)
Definition: open62541.c:24688
#define UA_STATUSCODE_BADDATATYPEIDUNKNOWN
Definition: open62541.h:671
UA_UsernamePasswordLogin usernamePasswords[2]
Definition: open62541.c:27588
#define UA_NS0ID_REPUBLISHREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2424
#define UA_TYPES_SETPUBLISHINGMODERESPONSE
Definition: open62541.h:4595
#define UA_TYPES_MONITORINGMODE
Definition: open62541.h:3437
#define UA_TYPES_REFERENCEDESCRIPTION
Definition: open62541.h:4581
#define UA_TYPES_ADDREFERENCESREQUEST
Definition: open62541.h:4793
UA_DataChangeTrigger
DataChangeTrigger ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3778
UA_MonitoredItemType
Definition: open62541.c:3828
#define UA_TYPES_VARIABLETYPEATTRIBUTES
Definition: open62541.h:4257
QueryFirstResponse ^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4970
#define UA_TYPES_APPLICATIONDESCRIPTION
Definition: open62541.h:4917
UA_ReadValueId * nodesToRead
Definition: open62541.h:4804
UA_MonitoringMode monitoringMode
Definition: open62541.h:4737
struct UA_SessionManager UA_SessionManager
UA_ExpandedNodeId targetId
Definition: open62541.h:3253
RepublishRequest ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4452
#define UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES
Definition: open62541.h:800
UA_StatusCode statusCode
Definition: open62541.h:4264
#define UA_TYPES_USERTOKENPOLICY
Definition: open62541.h:4350
UA_NotificationMessage notificationMessage
Definition: open62541.h:4726
#define UA_NS0ID_NUMBER
Definition: open62541.h:1821
#define UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED
Definition: open62541.h:820
enum UA_Job::@4 type
#define UA_STATUSCODE_BADFILTERNOTALLOWED
Definition: open62541.h:724
UA_RequestHeader requestHeader
Definition: open62541.h:4068
DataChangeNotification ^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4505
const char * LogCategoryNames[6]
Definition: open62541.c:27523
UA_UInt32 sendSequenceNumber
Definition: open62541.c:3241
const UA_DataType UA_TYPES[UA_TYPES_COUNT]
Definition: open62541.c:12129
UA_BuildInfo buildInfo
Definition: open62541.h:4833
UA_UInt32 sequenceNumber
Definition: open62541.c:2618
#define UA_TYPES_XMLELEMENT
XmlElement ^^^^^^^^^^.
Definition: open62541.h:3181
UA_NodeId * nodesToRegister
Definition: open62541.h:3972
#define UA_TRUE
Definition: open62541.h:923
#define UA_STRING_ALLOC(CHARS)
Definition: open62541.h:1060
#define UA_TYPES_DIAGNOSTICINFO
DiagnosticInfo ^^^^^^^^^^^^^^.
Definition: open62541.h:3235
#define UA_TYPES_CREATEMONITOREDITEMSREQUEST
Definition: open62541.h:4953
#define UA_TYPES_DELETEMONITOREDITEMSRESPONSE
Definition: open62541.h:3949
#define UA_STATUSCODE_BADWAITINGFORINITIALDATA
Definition: open62541.h:705
void Service_Browse_single(UA_Server *server, UA_Session *session, struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr, UA_UInt32 maxrefs, UA_BrowseResult *result)
Definition: open62541.c:22712
UA_UInt32 numeric
Definition: open62541.h:1175
#define UA_EMPTY_ARRAY_SENTINEL
Definition: open62541.h:1389
PublishResponse ^^^^^^^^^^^^^^^.
Definition: open62541.h:3993
UA_RelativePath relativePath
Definition: open62541.h:5016
UA_StatusCode __UA_Client_readAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, void *out, const UA_DataType *outDataType)
Definition: open62541.c:25847
#define UA_TYPES_CREATEMONITOREDITEMSRESPONSE
Definition: open62541.h:4690
UA_NodeId * registeredNodeIds
Definition: open62541.h:4306
UA_UserTokenType
UserTokenType ^^^^^^^^^^^^^ The possible user token types.
Definition: open62541.h:4051
UA_ConnectionState state
Definition: open62541.h:9479
UA_StatusCode UA_copy(const void *src, void *dst, const UA_DataType *type)
Definition: open62541.c:5680
UA_UInt32 serverIndex
Definition: open62541.h:1241
UA_LocalizedText displayName
Definition: open62541.h:3604
UA_String endpointUrl
Definition: open62541.c:4738
UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data)
Definition: open62541.c:18294
#define UA_malloc(_p_size)
UA_Variant * outputArguments
Definition: open62541.h:3450
void UA_deleteMembers(void *p, const UA_DataType *type)
Definition: open62541.c:5746
#define UA_STATUSCODE_BADTYPEDEFINITIONINVALID
Definition: open62541.h:760
UA_UserTokenPolicy * userIdentityTokens
Definition: open62541.h:5075
#define UA_STATUSCODE_BADNODATA
Definition: open62541.h:836
BrowseRequest ^^^^^^^^^^^^^ Browse the references for one or more nodes from the server address space...
Definition: open62541.h:5000
UA_StatusCode UA_Connection_receiveChunksBlocking(UA_Connection *connection, UA_ByteString *chunks, UA_Boolean *realloced, UA_UInt32 timeout)
Definition: open62541.c:14977
#define UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE
Definition: open62541.h:815
UA_StatusCode UA_Server_write(UA_Server *server, const UA_WriteValue *value)
The following node attributes cannot be changed once a node has been created:
Definition: open62541.c:21168
#define UA_STATUSCODE_BADFILTEROPERANDINVALID
Definition: open62541.h:731
#define UA_TRANSPORT_TCPMESSAGEHEADER
Definition: open62541.c:2633
#define UA_MAXCONTINUATIONPOINTS
Definition: open62541.c:3704
NodeTypeDescription ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5098
struct UA_DiagnosticInfo UA_DiagnosticInfo
DiagnosticInfo ^^^^^^^^^^^^^^ A structure that contains detailed error and diagnostic information ass...
#define UA_TYPES_REGISTERNODESRESPONSE
Definition: open62541.h:4309
#define UA_TYPES_DELETENODESREQUEST
Definition: open62541.h:3987
#define UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.h:178
#define MAX_PROFILEARRAY
UA_Double requestedSessionTimeout
Definition: open62541.h:5046
#define UA_TYPES_CALLRESPONSE
Definition: open62541.h:4704
#define UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED
Definition: open62541.h:783
#define UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID
Definition: open62541.h:748
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: open62541.c:502
BrowsePathResult ^^^^^^^^^^^^^^^^ The result of a translate opearation.
Definition: open62541.h:4263
#define UA_BUILTIN_TYPES_COUNT
Definition: open62541.h:916
#define UA_STATUSCODE_BADREQUESTTOOLARGE
Definition: open62541.h:660
struct pcg_state_setseq_64 pcg32_random_t
#define UA_TYPES_ENDPOINTDESCRIPTION
Definition: open62541.h:5080
OpenSecureChannelRequest ^^^^^^^^^^^^^^^^^^^^^^^^ Creates a secure channel with a server...
Definition: open62541.h:4288
#define UA_OPEN62541_VER_PATCH
Definition: open62541.h:41
#define UA_TYPES_NODEATTRIBUTESMASK
Definition: open62541.h:3423
#define UA_NS0ID_FOLDERTYPE
Definition: open62541.h:1849
#define UA_STATUSCODE_BADNOTWRITABLE
Definition: open62541.h:714
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3542
UA_Double minimumSamplingInterval
Definition: open62541.c:3465
UA_BrowseResult * results
Definition: open62541.h:5114
AddReferencesRequest ^^^^^^^^^^^^^^^^^^^^ Adds one or more references to the server address space...
Definition: open62541.h:4787
UA_NodeStore * nodestore
Definition: open62541.c:4220
#define UA_TYPES_QUERYFIRSTRESPONSE
Definition: open62541.h:4982
#define UA_STATUSCODE_BADREQUESTNOTALLOWED
Definition: open62541.h:854
UA_ByteString password
Definition: open62541.h:4026
#define UA_STATUSCODE_BADDECODINGERROR
Definition: open62541.h:658
#define UA_MSEC_TO_DATETIME
Definition: open62541.h:1074
void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session)
Definition: open62541.c:15217
#define UA_STATUSCODE_BADMAXAGEINVALID
Definition: open62541.h:780
#define STARTCHANNELID
Definition: open62541.c:18630
UA_RequestHeader requestHeader
Definition: open62541.h:3330
uint32_t UA_StatusCode
Definition: open62541.h:1011
#define UA_TYPES_CONTENTFILTERELEMENT
Definition: open62541.h:4890
#define TAILQ_HEAD(name, type)
Definition: open62541.c:432
#define UA_STATUSCODE_BADNOENTRYEXISTS
Definition: open62541.h:842
UA_MessageType
MessageType ^^^^^^^^^^^ Message Type and whether the message contains an intermediate chunk...
Definition: open62541.c:2574
#define UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED
Definition: open62541.h:678
UA_Boolean moreNotifications
Definition: open62541.h:3998
#define UA_STATUSCODE_BADMONITORINGMODEINVALID
Definition: open62541.h:720
UA_UInt32 maxChunkCount
Definition: open62541.h:9454
#define FLOAT_INF
Definition: open62541.c:6173
#define UA_TYPES_SETMONITORINGMODEREQUEST
Definition: open62541.h:4394
UA_UInt32 nodeClassMask
Definition: open62541.h:4442
#define UA_TYPES_NODEID
NodeId ^^^^^^.
Definition: open62541.h:3187
UA_StatusCode UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length)
Definition: open62541.c:4941
size_t endpointDescriptionsSize
Definition: open62541.c:4212
UA_StatusCode * results
Definition: open62541.h:4847
ModifySubscriptionResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4275
UA_Boolean historizing
Definition: open62541.h:3364
size_t dimensionsSize
Definition: open62541.h:1347
UnregisterNodesResponse ^^^^^^^^^^^^^^^^^^^^^^^ Unregisters one or more previously registered nodes...
Definition: open62541.h:4400
struct UA_Job::@5::@7 methodCall
UA_ViewDescription view
Definition: open62541.h:5002
PublishRequest ^^^^^^^^^^^^^^.
Definition: open62541.h:4479
#define UA_NS0ID_SERVER_NAMESPACEARRAY
Definition: open62541.h:2539
#define UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS
Definition: open62541.h:2770
UA_Boolean builtin
Definition: open62541.h:1658
UA_Int32 namespaceUri
Definition: open62541.h:1596
UA_AsymmetricAlgorithmSecurityHeader serverAsymAlgSettings
Definition: open62541.c:3237
MonitoredItemModifyRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4012
#define UA_STATUSCODE_BADDOMINANTVALUECHANGED
Definition: open62541.h:859
#define SIMPLEQ_INSERT_TAIL(head, elm, field)
Definition: open62541.c:326
UA_UInt32 timeoutHint
Definition: open62541.h:3306
#define UA_STATUSCODE_BADEVENTIDUNKNOWN
Definition: open62541.h:827
int64_t UA_Int64
Int64 ^^^^^ An integer value between -9 223 372 036 854 775 808 and 9 223 372 036 854 775 807...
Definition: open62541.h:979
#define UA_TYPES_CREATESUBSCRIPTIONRESPONSE
Definition: open62541.h:4637
#define UA_STATUSCODE_BADNODEIDREJECTED
Definition: open62541.h:754
#define UA_TYPES_EXPANDEDNODEID
ExpandedNodeId ^^^^^^^^^^^^^^.
Definition: open62541.h:3193
UA_ResponseHeader responseHeader
Definition: open62541.h:4276
CreateMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4682
#define UA_TYPES_CONTENTFILTERRESULT
Definition: open62541.h:4608
#define UA_TYPES_DATATYPEATTRIBUTES
Definition: open62541.h:3895
void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request, UA_BrowseNextResponse *response)
Definition: open62541.c:22927
UA_NodeId referenceTypeId
Definition: open62541.h:4616
#define LIST_REMOVE(elm, field)
Definition: open62541.c:258
#define UA_TYPES_BROWSERESULTMASK
Definition: open62541.h:3294
#define UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS
Definition: open62541.h:851
#define UA_TRANSPORT_TCPERRORMESSAGE
Definition: open62541.c:2568
void Service_SetPublishingMode(UA_Server *server, UA_Session *session, const UA_SetPublishingModeRequest *request, UA_SetPublishingModeResponse *response)
#define UA_TYPES_ADDNODESRESULT
Definition: open62541.h:3344
#define UA_PRINTF_STRING_FORMAT
Definition: open62541.h:9731
MonitoredItemNotification ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3840
#define UA_STATUSCODE_BADNODEIDINVALID
Definition: open62541.h:706
BrowsePathTarget ^^^^^^^^^^^^^^^^ The target of the translated path.
Definition: open62541.h:3252
size_t nodesToReadSize
Definition: open62541.h:4803
const UA_VariableTypeNode * getVariableNodeType(UA_Server *server, const UA_VariableNode *node)
Definition: open62541.c:17861
#define UA_NS0ID_SERVERSTATE
Definition: open62541.h:2444
ModifySubscriptionRequest ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4326
#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED
Definition: open62541.h:832
ModifyMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4528
void UA_Connection_detachSecureChannel(UA_Connection *connection)
Definition: open62541.c:15004
UA_UInt32 recvBufferSize
Definition: open62541.h:9452
size_t resultsSize
Definition: open62541.h:4698
#define UA_STATUSCODE_BADSHUTDOWN
Definition: open62541.h:665
#define CHECK_ATTRIBUTES(TYPE)
Definition: open62541.c:21920
UA_LocalizedText description
Definition: open62541.h:3958
UA_StatusCode errorCode
Definition: open62541.c:3229
AnonymousIdentityToken ^^^^^^^^^^^^^^^^^^^^^^ A token representing an anonymous user.
Definition: open62541.h:3552
#define UA_TYPES_OPENSECURECHANNELRESPONSE
Definition: open62541.h:4091
UA_StatusCode(* UA_EditNodeCallback)(UA_Server *, UA_Session *, UA_Node *, const void *)
Definition: open62541.c:4257
#define LIST_ENTRY(type)
Definition: open62541.c:205
UA_StatusCode UA_SessionManager_init(UA_SessionManager *sm, UA_Server *server)
Definition: open62541.c:18821
UA_String policyId
Definition: open62541.h:4343
#define UA_STATUSCODE_BADCONDITIONALREADYSHELVED
Definition: open62541.h:833
#define UA_NODE_BASEATTRIBUTES
Definition: open62541.c:3356
#define UA_NS0ID_CALLREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2310
#define UA_TRANSPORT_COUNT
Every type is assigned an index in an array containing the type descriptions.
Definition: open62541.c:2518
LocalizedText ^^^^^^^^^^^^^ Human readable text with an optional locale identifier.
Definition: open62541.h:1313
UA_Boolean hasSourceTimestamp
Definition: open62541.h:1570
#define UA_STATUSCODE_BADTCPMESSAGETYPEINVALID
Definition: open62541.h:797
#define UA_TYPES_BUILDINFO
Definition: open62541.h:3801
#define UA_TYPES_GETENDPOINTSRESPONSE
Definition: open62541.h:5092
CallRequest ^^^^^^^^^^^.
Definition: open62541.h:3590
UA_ChannelSecurityToken nextSecurityToken
Definition: open62541.c:3235
#define UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE
Definition: open62541.h:816
#define LIST_FIRST(head)
Definition: open62541.c:214
void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem)
UA_RequestHeader requestHeader
Definition: open62541.h:4289
ContentFilterElement ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4884
union UA_Job::@5 job
#define UA_TRANSPORT_SEQUENCEHEADER
Definition: open62541.c:2622
#define UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED
Definition: open62541.h:679
#define UA_STATUSCODE_BADENDOFSTREAM
Definition: open62541.h:871
UA_StatusCode UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId)
Definition: open62541.c:18247
#define UA_TYPES_QUALIFIEDNAME
QualifiedName ^^^^^^^^^^^^^.
Definition: open62541.h:3205
UA_LocalizedText displayName
Definition: open62541.h:4424
#define UA_TYPES_IDTYPE
Definition: open62541.h:4045
#define UA_NS0ID_BROWSEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2125